Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Datagridview sorting... Object must be of type Int32 exception

$
0
0

 

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.

 

Code Snippet

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

 

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>