I coded a datagridview so that whenever the last row is clicked a new row automatically gets created. I also insert an incremental number in the first column of the new row and I simply want the entire grid to always remain sorted by that column. When the user edits the column, I first validate it to be an integer and then I call the following sort operation on the datagridview's _CellValueChanged event.
DatagridView.Sort(DataGridView.Columns(0), System.ComponentModel.ListSortDirection.Ascending)
I tried it with the columns sortmode set to all of (Automatic, Programmatic & Not Sortable).
I am getting the following exception, and I cannot figure out what I am doing wrong.
{"Object must be of type Int32."}
Any insight will be appreciated.
sivilian