|
-
May 3rd, 2003, 08:07 AM
#1
Thread Starter
Hyperactive Member
ListView subitems...
There's a property that lets to modify items' labels in place, but how to modify subitems' labels?
Thanks
Learn, this is the Keyword...
-
May 3rd, 2003, 08:50 AM
#2
Fanatic Member
ListViewItem.Subitems(X).Text
where X is the subitem index e.g. for column 4, it would be subitem(3).
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWindowsFormsListViewItemClassSubItemsTopic.htm
Last edited by Slow_Learner; May 3rd, 2003 at 09:29 AM.
-
May 3rd, 2003, 11:38 AM
#3
Re: ListView subitems...
Originally posted by Xmas79
There's a property that lets to modify items' labels in place, but how to modify subitems' labels?
Thanks
Unless you are talking about the manual edit of a listitem's text, in which case I think that is possible on only the first subitem. Subitem(0) I guess.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 4th, 2003, 01:12 PM
#4
Thread Starter
Hyperactive Member
Uhm.. Then I think I have to move to some other control...
Thx..
Learn, this is the Keyword...
-
Mar 10th, 2005, 02:20 PM
#5
Fanatic Member
Re: ListView subitems...
Has anyone figured out a way to edit other subitems besides 0?
-
Mar 20th, 2005, 08:54 AM
#6
Junior Member
Re: ListView subitems...
assuming u got a blank list view called lvTest
so u try this out
VB Code:
lvTest.Items.Add("column1 thingie")
lvTest.Items(0).SubItems.Add("column2 thingie")
lvTest.Items(0).SubItems.Add("column3 thingie")
-
Mar 20th, 2005, 10:31 AM
#7
Lively Member
Re: ListView subitems...
As a general practise you may want to do place something like this at the top of the form containing the ListView to represent the columns, or subitems, that your ListView contains:
VB Code:
Const Grid_ID As Integer = 0
Const Grid_Name As Integer = 1
Const Grid_Address As Integer = 2
Const Grid_State As Integer = 3
Const Grid_City As Integer = 4
By doing so you can access the subitems in the following way, for say, editing:
VB Code:
MyListView.Items(MyIndex).SubItems(Grid_Name).Text = MyNewName
Plus if you ever reorder the columns you can just change the values for the consts that you declared at the top of your form and they will continue to access the correct subitem. Hope that helped!
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
|