Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Winform listview columns not showing up

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?

like image 511
jvcoach23 Avatar asked Feb 14 '11 21:02

jvcoach23


1 Answers

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.

like image 111
Justin Denton Avatar answered Oct 13 '22 23:10

Justin Denton