title: error when Load Data from datagridview To textbox vb.net
body: <p>i have an error to load data from Datagridview to TextBox . Look at the picture below <code>https://s32.postimg.org/m28ardoat/Sans_titre.png</code>
  My code : </p>
  
  <pre><code>Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick    
      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 ClientID, ClientName, ClientAddress, ClientPhone, ClientCredit, ClientLastPay FROM client where client.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
  
  End Sub
  </code></pre>
  
  <p>by debugging the error in this line :<code>Dim id As String = DataGridView1(2, DataGridView1.SelectedRows(0).Index).Value</code>
  hope to help me !</p>