I'm trying to put a listview on a VS 2010, vb.net winform form. I
1. drug the listview from the toolbox to the form.
2. right cick and did an edit columns
3. added two columns with the names of (chLocationID, chLocation) and the text of LocationID and Location.
4. when i click ok, nothing shows up in the listview designer.
In the code behind i did a for loop to add some data.
For Each O In oS
Dim itm As New ListViewItem
itm.SubItems.Add(O.tblLocationID.ToString)
itm.SubItems.Add(O.Location)
itm.Tag = O
lvLocation.Items.Add(itm)
Next
when i step through the code.. it says that it adds the row.. a lvLocation.items.count give me a value of 1.. which is correct but nothing displays on the screen.
So.. I've done something wrong.. just not sure what?
Make sure the ListView's View property is set to Details - either in the designer or in code. Winforms ListViews only show their columns in Details view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With