dashley
Well-known member
I'm having a problem getting a listview to display subitems.
I've never had a problem with it until I used the .NET CF for a ppc.
I've tried this code but it tells me I need an index ("additional information:index) on the line marked ** below. I add an index of zero to start with but no luck.
I've never had a problem with it until I used the .NET CF for a ppc.
I've tried this code but it tells me I need an index ("additional information:index) on the line marked ** below. I add an index of zero to start with but no luck.
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Contact1 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ListViewItem[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ListView1.Items.Add(Contact1)[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Contact2 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ListViewItem[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Contact3 [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] ListViewItem.ListViewSubItem[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ListView1.Items.Add(Contact2)[/SIZE]
[SIZE=2]Contact1.Text = "HELLO"[/SIZE]
[SIZE=2]Contact2.Text = "HELLO 2"[/SIZE]
[SIZE=2]Contact3.Text = "HELLO 3"[/SIZE]
[SIZE=2]Contact1.SubItems.Add(Contact3) ***[/SIZE]
[SIZE=2]ListView1.View = View.Details[/SIZE]
[SIZE=2]ListView1.Columns.Add("Col 1 ", 80, HorizontalAlignment.Center)[/SIZE]
[SIZE=2]ListView1.Columns.Add("Col 2 ", 80, HorizontalAlignment.Center)[/SIZE]
Last edited by a moderator: