I am trying to select a row in my datagrid.
There are two columns only.
The row displays into two text boxes. I am trying to figure out how to select the next row in my datagrid. I have tried looking at your examples but I am still having trouble.
Using visual basic. See my code below.
Private Sub btnDisplayListing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayListing.Click
Dim names() As String = IO.File.ReadAllLines("name.txt")
Dim query1 = From line In names
Let data = line.Split(","c)
Let name = data(0)
Let phonenum = data(1)
Select name, phonenum
dgvOutput.DataSource = query1.ToList
dgvOutput.CurrentCell = Nothing
dgvOutput.Columns("name").HeaderText = "Name"
dgvOutput.Columns("phonenum").HeaderText = "Phone Number"
dgvOutput.Focus() 'displays first name on list, must do a loop here.
txtName.Text = dgvOutput.CurrentRow.Cells(0).Value.ToString '// column 1.
txtPhoneNumber.Text = dgvOutput.CurrentRow.Cells(1).Value.ToString '// column 2
Dim i As Integer
dgvOutput.Rows(i).Selected = True
dgvOutput.CurrentCell = dgvOutput.Rows(i).Cells(0)
End Sub