I have a ListView with 3 columns. When I click a button, I want the first text to go to the first column, second text to the second column, and third text to the third column, but it's not working.
private void button1_Click(object sender, EventArgs e)
{
listView1.Column[0].SubItems.Add("my first text")
listView1.Column[1].SubItems.Add("my second text")
listView1.Column[2].SubItems.Add("my third text")
}
please help me
Thanks in advance
shreesh chandra shukla
17-Jul-2013Items first before subitems so try:
listView1.View = View.Details;
ListViewItem lvwItem = listView1.Items.Add("my first text");
lvwItem.SubItems.Add("my second text");
lvwItem.SubItems.Add("my third text");