I have been working on a time clock application, and I'm trying to be able to select an employee from the DataGridView and populate their information into text boxes. I have done some research and what I have found works . . . sometimes. So sometimes when I click on an employee it will show their name in the box other times I have to click around alot to do it. Any suggestions on a better way to do this?
Here's my code:
Private Sub dgvEmployee_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvEmployee.CellContentClick Dim dgvRow As DataGridViewRow For Each dgvRow In dgvEmployee.SelectedRows txtName.Text = dgvRow.Cells("Employee").Value.ToString Next End Sub