Hi I use following code to display selected row data of a datagridview in text boxes. The problem I have is that when user click an empty row of the datagrid view there is an error.
Please help
Private Sub DataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Dim i As Integer
i = DataGridView1.CurrentRow.Index
Me.txtBoxServTypeID.Text = DataGridView1.Item(0, i).Value
Me.txtBoxServiceType.Text = DataGridView1.Item(1, i).Value
Me.txtBoxCapacity.Text = DataGridView1.Item(2, i).Value
End Sub