开发者

Winform listview columns not showing up

开发者 https://www.devze.com 2023-02-10 05:54 出处:网络
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.

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开发者_Python百科 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号