This is the windows application:
so the thing is i want to get the id when user click the first row and then it goes on with all the rows but what is happening on there is the row is default selected when i select the first row i don't get the value but when i select the second row i get the first row value and it goes on, selecting 3rd row gives me 2nd row value but i don't want that i need the exact value.
int id_column_value = int.Parse(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString());
//selectedRows[0] 0 for the first select if you have multi rows selected.
//cell 0 for the first column which index at datagridview = 0 (id).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.