i have a problem when i click to item in datagridview to get more information ! ok ? my code :
Try
If (DataGridView1.Rows.Count = 0) Then Return
TextBox1.Text = String.Empty
TextBox2.Text = String.Empty
TextBox3.Text = String.Empty
TextBox4.Text = String.Empty
Dim id As String = DataGridView1(2, DataGridView1.SelectedRows(0).Index).Value
Dim dt As DataTable = New DBConnect().selectdata(String.Format("SELECT items.ClientName, items.ClientAddress, items.ClientPhone, items.ClientCredit, items.ClientLastPay FROM items where items.ClientID = {0}", id))
TextBox1.Text = dt.Rows(0)(0).ToString
TextBox2.Text = dt.Rows(0)(1).ToString
TextBox3.Text = dt.Rows(0)(2).ToString
TextBox4.Text = dt.Rows(0)(3).ToString
dt.Dispose()
dt = Nothing
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
by debugging the error is in this line :
Dim id As String = DataGridView1(2, DataGridView1.SelectedRows(0).Index).Value.ToString
thats my full source code http://up.dev-point.com/download279606.html