how to sort string as number in datagridview in winforms

Posted by Thunder on Stack Overflow See other posts from Stack Overflow or by Thunder
Published on 2010-04-20T11:36:07Z Indexed on 2010/04/20 12:03 UTC
Read the original article Hit count: 485

Filed under:
|
|
|

I have string column with numbers in a datagridview.It is not bound, I would like to sort it number wise I used

colid.ValueType = typeof(int); grid.Sort(colid, ListSortDirection.Descending);

but is sorts like string eg:

11 12 23 7 80 81

while the expexted is

7 11 12 23 80 81

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms