Sorting a dataview Numerically

  • Thread starter Thread starter Saputra
  • Start date Start date
S

Saputra

Does anyone know how to sort a data view numerically? By default, when
you sort a field from a table in a database, it sorts it in
alpha-numerical order. In MS Access, sort is by alpha-numeric, that
is, numbers sort from 1, 10 ,11, 1X, 2, 21, 2X, etc. I want VB.NET to
sort a column in data view numerically, so it goes 1 - 9, 10 - 19, 20 -
29, etc..
 
Hi!
Does anyone know how to sort a data view numerically? By default, when
you sort a field from a table in a database, it sorts it in
alpha-numerical order. In MS Access, sort is by alpha-numeric, that
is, numbers sort from 1, 10 ,11, 1X, 2, 21, 2X, etc. I want VB.NET to
sort a column in data view numerically, so it goes 1 - 9, 10 - 19, 20 -
29, etc..

When you put data into DataTable/DataSet put objects implementing
IComparable interface and set 'DataType' property of 'DataColumn' class.
I supose you store 'string' values in the columns instead of simply 'int'
or you have created columns just giving them names and forgot to set
'DataType'.

Cheers,
Piotrek
 
Back
Top