VB doesn't include a dictionary class, so I presume you are using the vbscript dictionary. If so, afraid it does not have a sort method, so you,ll have to write yourself a sort function. But dictionaries are specifically designed as random access, so if you need sorting, then perhaps it is the wrong class to use. What are you trying to achieve?
I read a txt line by line, and get DATA from a Mid, position from each line, to the and of loop, i need to fill a combobox with a ordered DATA.
The string DATA not is ordered during the loop in txt...
in VB6, Combo box has Sorted property, but in the tip it says: "Indicates whether the elements of a control are automatically sorted alphabetically". Since it looks like you have Dates to display, that may not work for you :-(
So you don't actually need a dictionary? That's what I am trying to get at. You just want an array that you can sort? Or is there info missing from your description?
I ask because of it you are just using the ductiobary as a simple array, then you could instead use VB.nets ArrayList with a custom sort comparison function.
And yes, you can use various .net bits and pieces in VB. I've illustrated the idea mentioned above previously in a thread222-1695412; look for my post of 15 Oct 12 19:17
Oh, the Date format…
Looks like I was years ahead of time while attending high school (a long time ago and far, far away from USA) where – back then - in my notes I did write in the format of 2020-11-19
You know, you could use a Bubble Sort for your dates, or… you can cheat. Let the (other) combo box do the sorting for you.
Have another combo box with the Sort property set to True, populate it with the dates from your text file in the YYYY-MM-DD format, which will put them in the order you want. Then you can use this extra combo box to populate your original combo with the dates in any format you want.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.