Hi! Can someone help me?
I have a datagridview and I declared this code:

i = dgStudentsHandled.CurrentRow.Index
txtStudentNumber.Text = dgStudentsHandled.Item(0, i).Value

.

I can get the value of the first cell of the first row of the first column. But I have to get the value of the first cell of the the first column of the any row index I click. Thank you very much and God Bless. :)

Recommended Answers

>>value of the first cell of the the first column of the any row index you click.
just put your code on the right event.

Private Sub dgStudentsHandled_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgStudentsHandled.CellClick
   Dim i As Integer
   i = dgStudentsHandled.CurrentRow.Index
   txtStudentNumber.Text = dgStudentsHandled.Item(0, …
Jump to Post

All 3 Replies

>>value of the first cell of the the first column of the any row index you click.
just put your code on the right event.

Private Sub dgStudentsHandled_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgStudentsHandled.CellClick
   Dim i As Integer
   i = dgStudentsHandled.CurrentRow.Index
   txtStudentNumber.Text = dgStudentsHandled.Item(0, i).Value
End Sub

Thank you very much and God Bless. We used the same concept. :)

you're welcome..
if this thread already done then please mark as solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.