I have this datagrid view:
Now when the first row is double clicked i want its all data to be saved in variables, like the field
name should come in a variablename
First Name should come in another variaablename
fname and so on.
I have been trying to get the values using
DataGridView1.CellContentDoubleClick event, with the property called
SelectedCells but the intellisense is not providing me any information on how i can get the value of each column in that particular selected row.
To get the data straight from the datagridview you could do the following:
Dim fName As String = String.Empty Dim sName As String = String.Empty Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick If DataGridView1.SelectedRows.Count <> 0 Then Dim row As DataGridViewRow = DataGridView1.SelectedRows(0) fName = row.Cells("fNameColumnName").Value sName = row.Cells("sNameColumnName").Value End If End Sub
This wont however work with the multiselect property set to true!