first column empty?

Need4Speed

Member
Joined
Apr 4, 2007
Messages
8
Programming Experience
Beginner
Thx for all the help :)


VB.NET:
Expand Collapse Copy
        Dim NewItem As New ListViewItem
        'NewItem.SubItems.Clear()
        NewItem.SubItems.Add(strLastName)
        NewItem.SubItems.Add(strFirstName)
        NewItem.SubItems.Add(strStreet)
        lvResults.Items.Add(NewItem)

the first cell of the row in the listview item stays empty and strLastName ends up in the second cell. How come?
 
You can set the item text:
VB.NET:
Expand Collapse Copy
NewItem.Text = "hello listview"
this can also be done with one of the constructors:
VB.NET:
Expand Collapse Copy
Dim NewItem As New ListViewItem("hello listview")
or for example this variant where Add method returns the new ListViewItem:
VB.NET:
Expand Collapse Copy
Dim NewItem As ListViewItem = ListView1.Items.Add("hello")
NewItem.SubItems.Add("sub hello listview")
 
Back
Top