data grive view event handlers

ict-torquilclark used Ask the Experts™
I have a datagrid view in a form. I want the user to be able to double click one of the records and for it to open a form with a variable assignes as one of the recirds from the row that was cliked.

Is there an event handeler and something that will recognise which row was clicked?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use the MouseDoubleClick event and in there check the DataGridView.SelectedRows property


I am trying to get the data from the "EmployerRef" column of the selected row into a variable "EmpRef"

how do i go about doing this?

what is the column number of employerRef, what type of column is it, and is it a control if the column is a TemplAteField.
Most Valuable Expert 2012
Top Expert 2014
The event is called DoubleClick and you can get the value like this

If dgv.SelectedRows.Count = 1
  Dim Ref As (type depending on type of employerref) = dgv.SelectedRows(0).Cells("EmployerRef").Value
End if

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial