I have a data grid on my form filled by a dataset. On the SelectionChanged event I have this code:
int index = dataGridView1.CurrentRow.Index;
But when you click the column to sort the data, a null reference expection gets thrown.
I need to be able to get the current row they have selected and get data out of it. How can I do this?
1 Answer