vb.net datadrig view get each cell value
- by Gbolahan
hello i'm trying to get the first value of a datagrid cell value but it keeps looping trough and returns the last value. here is the code:
Dim cell As DataGridViewCell
txtoccupier.Text = ""
Try
For Each cell In dgvREcord.CurrentRow.Cells()
txtoccupier.Text = cell.Value.ToString
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Try
End Try
record eample:
id name email
1 test [email protected]
it returns only [email protected] but i want to get only the id which is 1
thanks for your help