EFileTahi-A
Contributor
I have a listview set to viewmode = details with 4 columns defined. I just need to know how can I add text to a specific column, let's say column number 2?
listView1.Items.Add("Item 1").SubItems.Add("SubItem 1");
for (int i = 0; i < 2000; i++)
{
//Adds items to the first and second columns
this.listView1.Items.Add("bla" + i).SubItems.Add("bla" + i);
//This adds an item to the third column
this.listView1.Items[i].SubItems.Add("bla" + i);
//This adds an item to the forth column
this.listView1.Items[i].SubItems.Add("bla" + i);
// etc...
}
If you just want to access for example the second column, you can do something like:But what if I just want to add a item at column 2 instead of add values to columns 1 and 2?
Because I only have access to subitems properties after adding to the first item too...
listView1.Items[0].SubItems[1].Text = "Whatever";
listView1.Items["ItemKey"].SubItems[1].Text = "New Text";
this.ListView1.Items[3].Selected = true;
EFileTahi-A said:lol, I found it by the time I las posted.... But tks anyway...
Now am trying to select an item through code, but I just can't! Why there is no simple option like listView1.SelectIndex = 0???