3/2/11

DataGridViewRow cell click

Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick Dim r As New DataGridViewRow If DataGridView1.Rows.Count > 0 Then r = DataGridView1.Rows(e.RowIndex) TextBox1.Text = r.Cells(0).Value TextBox2.Text = r.Cells(1).Value TextBox3.Text = r.Cells(2).Value price.Text = r.Cells(3).Value / r.Cells(2).Value End If End Sub