Click here to Skip to main content
15,910,277 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Audio mute Pin
Dave Kreskowiak23-Feb-05 4:08
mveDave Kreskowiak23-Feb-05 4:08 
GeneralPop up menu Pin
Anonymous23-Feb-05 1:34
Anonymous23-Feb-05 1:34 
GeneralRe: Pop up menu Pin
Dave Kreskowiak23-Feb-05 3:56
mveDave Kreskowiak23-Feb-05 3:56 
GeneralApp.config Pin
nitin_ion23-Feb-05 1:14
nitin_ion23-Feb-05 1:14 
GeneralRe: App.config Pin
Dave Kreskowiak23-Feb-05 3:30
mveDave Kreskowiak23-Feb-05 3:30 
QuestionHow can I access a class written in C++ in a VB project?? Pin
Logan from Singapore22-Feb-05 22:59
Logan from Singapore22-Feb-05 22:59 
AnswerRe: How can I access a class written in C++ in a VB project?? Pin
Dave Kreskowiak23-Feb-05 0:41
mveDave Kreskowiak23-Feb-05 0:41 
Generalproblems impleminting ListView.ListViewItemCollection.Contains Pin
ASDEF000122-Feb-05 19:36
ASDEF000122-Feb-05 19:36 
I am attempting to write a program that will list the running processes on a computer. I currently have a listView box that stores the running processis as items in the ListView. The ListView must update every so often (2 secons or so).
But when it updates it must check to see if a process is already contained in the list. For example there are usually four or so processes with the name svchot.exe, so we must make sure that we also check the PID (a subitem for each item that stores the "Process ID").

My problem is that when I attempt to check if an item is in the listView, it is not found. Here is the coded snipet in question.

'Takes three parameters: lvw is the ListView that contains all of the items,
'item_title is the name of the item we want to add (process name),
'subitem_titles() is an array of strings containing the subitems (PID, CPU time...) Private Sub ListViewMakeRow(ByVal lvw As ListView, ByVal ProcessName As String,_ ByVal ParamArray subitem_titles() As String)


'Temporary ListViewItem used to create a lvw
Dim ListItemTemp As New ListViewItem(ProcessName)


'check to see if our TempListItem is found in lvw
'At least that is what it is supposed to do.
If Not (lvw.Items.Contains(TempListItem)) Then
Dim new_item As ListViewItem = lvw.Items.Add(ProcessName)
For i As Integer = subitem_titles.GetLowerBound(0) To _
subitem_titles.GetUpperBound(0)
new_item.SubItems.Add(subitem_titles(i))
Next i
Else

End If
End Sub

At the moment I am only trying to see if I can check to see if the item is already in the ListView. Later on I will add more checks to see if it is a different process.
Currently the process will continue to add more items to the list even if the item is found in the list. I am not able to debug it to see which items are already in the list and to see if it is making the correct decision. However I know that it does not work because every half a second or so another item with the same name is added to the list (every second a process named “explorer.exe” is added… and so on for each process that runs.

So the question is can anyone point me to a good tutorial on the:
ListView.ListViewItemCollection.Contains
or to some other way of checking the ListView. I have looked at microsofts inof for the ListView class
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformslistviewitemlistviewsubitemclasstopic.asp
however their example does not use the Contains method.

I will attempt to use GetIndexOf. However I am not sure how that would work if there are multiple items with the same name.
Thanks in Advance
Donald Carlson, Jr.
Generalwell in order to solve the problem i used IEnumorator Pin
ASDEF000122-Feb-05 21:29
ASDEF000122-Feb-05 21:29 
QuestionHow to convert a htm page to asp page Pin
GoldenStar22-Feb-05 14:34
GoldenStar22-Feb-05 14:34 
AnswerRe: How to convert a htm page to asp page Pin
Christian Graus22-Feb-05 14:49
protectorChristian Graus22-Feb-05 14:49 
GeneralRe: How to convert a htm page to asp page Pin
GoldenStar22-Feb-05 15:40
GoldenStar22-Feb-05 15:40 
GeneralContext menu in different listviews Pin
22-Feb-05 11:00
suss22-Feb-05 11:00 
GeneralDifference between CreateObject and New method Pin
Mahesh167922-Feb-05 8:26
Mahesh167922-Feb-05 8:26 
GeneralRe: Difference between CreateObject and New method Pin
Christian Graus22-Feb-05 8:47
protectorChristian Graus22-Feb-05 8:47 
GeneralCombo Hack Pin
buildero22-Feb-05 4:19
buildero22-Feb-05 4:19 
GeneralRe: Combo Hack Pin
Colin Angus Mackay22-Feb-05 4:34
Colin Angus Mackay22-Feb-05 4:34 
Generalopening a form from a string name Pin
Shawn200022-Feb-05 3:18
Shawn200022-Feb-05 3:18 
GeneralRe: opening a form from a string name Pin
Dave Kreskowiak22-Feb-05 3:58
mveDave Kreskowiak22-Feb-05 3:58 
GeneralRe: opening a form from a string name Pin
Shawn200022-Feb-05 4:36
Shawn200022-Feb-05 4:36 
GeneralRe: opening a form from a string name Pin
Dave Kreskowiak22-Feb-05 6:09
mveDave Kreskowiak22-Feb-05 6:09 
GeneralPrinting + Encoding Magstripe Pin
YorkTech22-Feb-05 0:02
YorkTech22-Feb-05 0:02 
GeneralRe: Printing + Encoding Magstripe Pin
Dave Kreskowiak22-Feb-05 0:48
mveDave Kreskowiak22-Feb-05 0:48 
GeneralRe: Printing + Encoding Magstripe Pin
YorkTech22-Feb-05 7:11
YorkTech22-Feb-05 7:11 
GeneralRe: Printing + Encoding Magstripe Pin
Dave Kreskowiak22-Feb-05 7:32
mveDave Kreskowiak22-Feb-05 7:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.