Sorting a dataview Numerically

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..
 
P

Piotr Szukalski

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top