I have a datagridview. When I click on the header and sort it asc or desc by a cell and then double click a selected row to load that record I find the index for that row is wrong - it loads the record that was originally at that index how can I fix that?
I tried this but that didnt work
bool jobNum = int.TryParse(GV_DH.CurrentRow.Cells["run"].EditedFormattedValue.ToString(), out jobnum1);
if (jobNum == true)
int rowIndex = -1;
foreach (DataGridViewRow row in GV_DH.Rows)
if (Convert.ToInt32(row.Cells["run"].EditedFormattedValue.ToString()) == jobnum1)
rowIndex = row.Index;