Datagridvie oncelldoublclick get the data of the clicked row


first we bind the dataset to Datagridview..

then here wat we do is while we double click on the any row of the Datagridview

we retrieve the data of the particular row by using the ID

so we have to write it on Datagridview_CellDoubleClick Event

Private Sub Boatname_DataGridView_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Boatname_DataGridView.CellDoubleClick
Dim dgresult As New DialogResult
dgresult = MessageBox.Show("Are You Sure Want To Edit This Record", msgtitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If dgresult = Windows.Forms.DialogResult.Yes Then
boatNameID = Boatname_DataGridView.Rows(e.RowIndex).Cells(1).Value
BoatName_TextBox.Text = Boatname_DataGridView.Rows(e.RowIndex).Cells(0).Value

Save_Button.Visible = False
Update_Button.Visible = True
Delete_Button.Visible = True
End If
Catch ex As Exception
End Try
End Sub


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: