title: VB.Net Must be non-negative and less than the size of the collection
body: <p>Index was out of range. I was trying to put the selected rows in <code>frm_Guest</code> to <code>frm_Main</code>:</p>
  
  <pre><code>Private Sub dgview_GPIGuest_CellContentClick_1(sender As Object, e As 
      DataGridViewCellEventArgs) Handles dgview_GPIGuest.CellContentClick
    Dim ID As String = dgview_GPIGuest.SelectedRows(0).Cells(0).Value.ToString()
    Dim FName As String = dgview_GPIGuest.SelectedRows(0).Cells(1).Value.ToString()
    Dim LName As String = dgview_GPIGuest.SelectedRows(0).Cells(2).Value.ToString()
    Dim Gender As String = dgview_GPIGuest.SelectedRows(0).Cells(3).Value.ToString()
    Dim Address As String = dgview_GPIGuest.SelectedRows(0).Cells(4).Value.ToString()
    Dim IDType As String = dgview_GPIGuest.SelectedRows(0).Cells(5).Value.ToString()
    Dim IDNumber As String = dgview_GPIGuest.SelectedRows(0).Cells(6).Value.ToString()
  
    frm_Main.txt_GPIId.Text = ID
    frm_Main.txt_GPIFirstName.Text = FName
    frm_Main.txt_GPILastName.Text = LName
    frm_Main.txt_GPIAddress.Text = Address
    frm_Main.txt_GPIIDNumber.Text = IDNumber
    frm_Main.txt_GPIIdType.Text = IDType
    If Gender = "Male" Then
      frm_Main.rb_GPIMale.Checked = True
    Else
      frm_Main.rb_GPIFemale.Checked = True
    End If
  End Sub
  </code></pre>