Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Sort not working as intended 1

Status
Not open for further replies.

GPerk

Programmer
Jul 6, 2002
161
0
0
US
I have several data files where the first 8 characters on each line is the date in YYYYMMDD format.
Immediately following the date is a one-letter code.
For example:
20100531P Some data
20100531n Some more data

When I add these two lines to the listbox, I want them in the sequence shown in the example.
The 'n' was deliberately chosen so that 2 entries with the same date would be in that sequence.
(The Sort property is set to True.)

But the entries show up in this order:
20100531n Some more data
20100531P Some data

Since the ascii value for n is hex 6E
and the ascii value for P is hex 50,
why are the entries ending up with the n before the P?
 
In my opinion, it seems like its sorting alphabetically, hence 'n' comes before 'P', therefore the sort is working correctly. Hex values shouldn't have anything to do with it as a hex value is not being displayed.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Thanks, Bluejay07.

Then that means the control is converting everything to lower case to determine the sort sequence.
I knew that search engines and the internet in general did that; didn't know VB2008 also does.

But it used to work the way I wanted it to, until I rebuilt the program a few months ago.

Looks like I will have to write a program to go thru the data files and change the code letters in them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top