vb.net - Inserting all the rows in a List View to a Data Grid View -
i have listview
has several items. want pass items datagridview
keep getting error:
an unhandled exception of type 'system.argumentoutofrangeexception' occurred in system.windows.forms.dll additional information: invalidargument=value of '14' not valid 'index'.
this code use:
dim num integer num = 0 while (num <= listview1.items.count) listview1.items(num) dim lvitem() string = {.text, .subitems(1).text, .subitems(2).text, .subitems(3).text, .subitems(4).text, .subitems(5).text, .subitems(6).text} '// listview selecteditem. datagridview1.rows.add(lvitem) '// add datagridview. end num = num + 1 end while
use while (num < listview1.items.count)
in place of while (num <= listview1.items.count)
Comments
Post a Comment