vb.net - How can I tell where is the cursor on dataGridView? -
i using vb.net, datagridview. on image on link, cursor on third row, user can select other rows ofcourse, how can tell row curretly selected if any?
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview_properties(v=vs.100).aspx
you access datagridview.rows collection , pass index it.
dim rowindex = datagridview1.currentcell.rowindex msgbox(datagridview1.rows(rowindex).cells(0).value) if have datagridview.multiselect set true access items through datagridview.selectedrows collection , loop through them in collection 0 indexed.
'loop each row datagridviewrow in datagridview1.selectedrows msgbox(row.cells(0).value) next 'or access them index in collection datagridview.selectedrows(0).cells(0).value
Comments
Post a Comment