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?

http://s30.postimg.org/5fb70arup/image.png

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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -