Steps to do:
1) Select button
2) Go to the Properties window (right-bottom corner)
3) Choose events tab
4) Find "Click" event
5) Choose "DGV_CellClick" event
That's all!
[EDIT]
Use
DataGridView.CurrentRow[
^] property and "export" the body of procedure
Dgv_CellClick
into another one (for example
UpdateText
).
Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
UpdateText()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
UpdateText()
End Sub
Private Sub UpdateText()
Dim cr As DataGridViewRow = Nothing
Try
cr = Me.DataGridView1.CurrentRow
Me.Txt_Name.Text = "new text"
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Exclamation, "Error")
Finally
cr = Nothing
End Try
End Sub
[\EDIT]