Hi All,
I'm learning c# so apologies if this is a stupid question
I get the error 'listviewitem does not contain a constructor that takes 1 arguments'.
The code I'm using is the following
string[] lViewItem = new string[2];
foreach (Collect c in collect)
{
lViewItem[0] = c.Id.ToString();
lViewItem[1] = c.Name;
ListViewItem lvi = new ListViewItem(lViewItem);
listView1.Items.Add(lvi);
What am I doing wrong.
Thanks in advance.
Loading

VulpesRank #55 · 29.2K reputationPosted Mar 15, 2011, 11:02 AM EDT
FroglegRank #1,020 · 1.9K reputationPosted Mar 14, 2011, 2:43 PM EDT
Iain7 reputationPosted Mar 14, 2011, 2:47 PM EDT
I should have probably called it something different but it suited my needs at the time
FroglegRank #1,020 · 1.9K reputationPosted Mar 14, 2011, 2:58 PM EDT
ListViewItem lvt = new ListViewItem(item name);
lvt.Tag = (item name);
lvt.Text = (item name);
listView1.Items.Add(lvt);
Upload your whole project if you can't make it work
Sam HobbsRank #107 · 20.5K reputationPosted Mar 14, 2011, 3:56 PM EDT
Iain7 reputationPosted Mar 15, 2011, 9:39 AM EDT
This is the error I get in the output window
Sam HobbsRank #107 · 20.5K reputationPosted Mar 15, 2011, 11:25 AM EDT
Iain7 reputationPosted Mar 15, 2011, 2:59 PM EDT
I shall take more care where I post in future.
It is a struggle getting through the documentation for someone learning this like myself. I shall try and understand it better before posting in future.
Thanks for your help, it's appreciated.
Sam HobbsRank #107 · 20.5K reputationPosted Mar 15, 2011, 3:14 PM EDT