item1.SubItems.Add(varintx[x]);
// my code //
ERROR CS1503 C# Argument 1: cannot convert from 'int' to "System.Windows.Forms.ListViewItem.ListViewSubItem"
How to add a "int array" like a subitem of a listview
for (Int32 i = 0; i < varintx.Length; ++i)
{
ListViewItem item = new ListViewItem();
item.SubItems.Add(varintx[i].ToString());
myListVIew.Items.Add(item);
}
You have to convert your int values to string before passing them to the ListViewItem. So your code excerpt should be rewritten as follows:
item1.SubItems.Add(varintx[x].ToString());
varintx[x].ToString()cannot convertConvert being the key word , frominto to ListViewItem.ListViewSubItemdoing a msdn search on the error or google would tell you the data type that SubItem is expecting.. I would refresh yourself on the.ToString() extension method as well as theConvert.ToString()` method when you get a chance