Вопрос

Code

I'm trying to write Column 1 + Column 2 for every row but I keep getting:

Error

I actually had it working at one point, but I re-opened the project and now it doesn't. Any idea as to what's happening?

Это было полезно?

Решение

the discription of listitem.clear:Removes all items and columns from the control. http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.clear(v=vs.110).aspx

Since the are no items in the listview you cannot retieve the first one(listview1.items[0])

Другие советы

You trying to access an array where the there is no data. You can surround it with a try catch also to avoid crash. or test there is data with an if clause

if(listview1.Items[0].subItems[1]!=null)
  sr.write(...);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top