vb.net - copying specific cell value from multiple dgv to a specific cell in all rows of dgv by loop -
i have 2 forms: form2 dgv, form3 tabcontrol having number of tab pages each of them dgv inserted. want cell(1) value of each row in form2 dgv equal value of cell(1) of row(13) in multiple dgv of form3 that:
datagridview1.rows(0).cells(1).value = form3.datagridview1.rows(13).cells(1).value datagridview1.rows(1).cells(1).value = form3.datagridview2.rows(13).cells(1).value datagridview1.rows(2).cells(1).value = form3.datagridview3.rows(13).cells(1).value, etc.
i trying following code:
for integer = 0 datagridview1.rows.count - 1 'dgv in form2 each tp tabpage in form3.tabcontrol1.controls.oftype(of tabpage)() each dgv datagridview in tp.controls.oftype(of datagridview)() datagridview1.rows(i).cells(1).value = dgv.rows(13).cells(1).value next next next
but result, last dgv in form3 tabcontrol shows requested data rows of form2 dgv. missing, highly appreciated.
it because looping through tabpages inside of land on last tab i=0, i=1 etc
dim integer = 0 each tp tabpage in form3.tabcontrol1.controls.oftype(of tabpage)() each dgv datagridview in tp.controls.oftype(of datagridview)() if < datagridview1.rows.count datagridview1.rows(i).cells(1).value = dgv.rows(13).cells(1).value 1 += 1 end if next next
Comments
Post a Comment