ListView Column add not correct?

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
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
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json