|
-
April 28th, 2009, 06:03 AM
#1
Listview.SubItems not exist?
I was attempting to follow a few tutorials for the ListView control. I am able in the designer to add items and subitems but I want to be able to add them in at runtime. I can do ListView1.Items.Add quite fine but when I attemp to input ListView1.SubItems (As the tutorial suggests) I get an error that is:
Code:
'SubItems' is not a member of 'System.Windows.Forms.ListView'
I am using Visual Basic.NET 2008 Express.
-
April 28th, 2009, 07:21 AM
#2
Re: Listview.SubItems not exist?
Subitmes are Items of an Item. ListView1 in your case does not contain subitems. ListView1.Items(0) however would contain SubItems.
I like to add items by using a listview item. This to me makes the code much more readable.
Code:
Dim LSingleItem As ListViewItem
LV.Clear()
LV.View = View.Details
LV.GridLines = True
LSingleItem = LV.Items.Add("Text")
LSingleItem.SubItems.Add("SubItem Text")
or.....
LSingleItem = LV.Items(1)
LSingleItem.SubItems.Add("SubItem Text")
Where LV is my listview.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|