1

I been having a problem in may col - 1 it said that Cannot convert from 'int' to System.Windows.Form.ListViewItem.ListViewSubitem

i tried this code but didn't work ListViewItem Item = new ListViewItem();

this is my code:

Item.SubItems.Add(col - 1).Text = "IN-GATE USER";

1 Answers1

1

Try this:

ListViewItem lvi = new ListViewItem();
lvi.SubItems.Add("IN-GATE USER");
listView1.Items.Add(lvi);

You have more information on this answer: C#: How to add subitems in ListView

NicoRiff
  • 4,803
  • 3
  • 25
  • 54
  • it works dude can i ask one more? can you explain why did he do this?? Item.SubItems.Add(col - 1).Text = rsUser.GetData(Convert.ToInt16(i)).ToString(); and it also the same error in col also – Reden Rodriguez Jun 29 '18 at 00:44