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(co
Create a class like:
class Sort : IComparer { public int Compare(object x, object y) { return -int.Parse((string)x).CompareTo(int.Parse((string)y)); //sort descending //return int.Parse((string)x).CompareTo(int.Parse((string)y)); //sort ascending } }
and do
grid.Sort( new Sort() );