1
Answer

Sort a datagrid column by ascending numerical order?

John Beeman

John Beeman

16y
4.4k
1
I am having trouble figuring out how to sort a datagridview using the code below. The column has integer values (anywhere from about 1-100). It appears that the problem is it sorts on the first digit (e.g., 7 sorts below 19 because 7 is greater than 1) instead of the entire number. Does anyone know a way around this issue?

dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending);
Answers (1)