'DisplayMember' is not a member of 'System.Windows.Forms.ListView'.

L

Lynn

Hi,
I am trying to display the processes running on my system to a listbox. but
i got 'DisplayMember' is not a member of 'System.Windows.Forms.ListView'.
during debug.
any clues? below is the code



Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click


Try
Dim prc As Process
' Remove existing items from the control.
ListView1.Items.Clear()

' Fill the control. Indicate which member of
' the items added to the list box should be
' displayed.
ListView1.DisplayMember = "ProcessName"
For Each prc In Process.GetProcesses()
ListView1.Items.Add(prc)
Next
ListView1.Sorted = True
Catch exp As Exception
MessageBox.Show(exp.Message, Me.Text)
End Try

End Sub
 
H

Herfried K. Wagner [MVP]

Lynn said:
I am trying to display the processes running on my system to a listbox.
but
i got 'DisplayMember' is not a member of 'System.Windows.Forms.ListView'.
during debug.

'ListView' does not have a 'DisplayMember' property.
 
S

Stoitcho Goutsev \(100\)

Lynn,

You should probably use the simpler ListBox control. ListView does not
inherit from ListControl that declares this property neither declare one on
its own
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top