8

I have a datagridview which is filled with data from db and i need to do this: when click on a row in datagrid all the fields with data from this row will be in other textboxes or something else. How to do so? Thanks in advance.

1 Answer 1

20

On your CellClick event, do int rowIndex = e.RowIndex. From there you can do DataGridViewRow row = DataGridView1.Rows[rowIndex] and access all the cells in row (or better yet, from your underlying DataTable).

1
  • it helped me, and saved some precious time Feb 20, 2014 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.