简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM