ListView Column add not correct?

0
0

I’m executing this code:

for (int i=0; i< 15; i++)
{
ListViewItem lvi = new ListViewItem();
lvi.SubItems.Add(“One”);
lvi.SubItems.Add(“Two”);
lvi.SubItems.Add(“Three”);
this.listView1.Items.Add(lvi);
}

and getting this result (image attached):

 

Attachment
  • You must to post comments
0
0

You’re right, I forgot Winforms, been programming VWG for about years and the code I posted was VWG. Suggestions worked fine. Sorry for false alarm and thanks for the responses 🙂

  • You must to post comments
0
0

Hi Conrad,

I get exactly the same in WinForms. Which result were you expecting ?
To set the value of the first column in your sample, try setting lvi.Text.

Hope that helps.

Best regards
Frank

 

  • You must to post comments
0
0

That seems correct. Subitems start at the second column. The first column is the item. See attached image from the same code in winforms.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.