Listview subitems !HELP!

C

CSharp-Jay

Okay I have to reach out at this point. A few days ago I came in here
asking a question about how to add subitems to a listview. It wasn't
the first time I had been lost on it. For starters, I am a programmer
currently in College, so I am fairly new to programming but have
dabbled in it for years. Moving on, there is plenty of content on the
internet explaining how to use the listview but I can never get it.
Every single time I try to do this, it turns into an epic saga that
goes on for days because I cannot figure it out. Plain and simple all
I want to do is add a subitem to my list in code. My listview is
called lstInventory, it has 2 columns. I can add anything I want to
the first column no problem, the subitem(second column) as always
doesn't work. Can somebody please help me before I throw my computer
out the window?
 
J

Jeff Gaines

Okay I have to reach out at this point. A few days ago I came in here
asking a question about how to add subitems to a listview. It wasn't
the first time I had been lost on it. For starters, I am a programmer
currently in College, so I am fairly new to programming but have
dabbled in it for years. Moving on, there is plenty of content on the
internet explaining how to use the listview but I can never get it.
Every single time I try to do this, it turns into an epic saga that
goes on for days because I cannot figure it out. Plain and simple all
I want to do is add a subitem to my list in code. My listview is
called lstInventory, it has 2 columns. I can add anything I want to
the first column no problem, the subitem(second column) as always
doesn't work. Can somebody please help me before I throw my computer
out the window?

ListViewItem lvItem = new ListViewItem("Column 0 text");
lvItem.SubItems.Add("Column 1 text");

then add to ListView:
MyListView.Items.Add(lvItem);
 
C

CSharp-Jay

ListViewItem lvItem = new ListViewItem("Column 0 text");
lvItem.SubItems.Add("Column 1 text");

then add to ListView:
MyListView.Items.Add(lvItem);

--
Jeff Gaines Dorset UK
Greater love hath no man than this, that he lay down his friends for his
life.
(Jeremy Thorpe, 1962)

Perfect! Thank you :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top