문제

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