Simple Function To Sort Standard Collections
Category:Lists, Collections and Arrays
Version Compatibility: Visual Basic 6, Visual Basic 5
Sure, you could write your own collection class that will sort as items are added, but this is just a shortcut for dealing in your good old VB Collections. I wrote this just now to sort a list that I'm using throwing into a menu. I'd like the menu to be sorted, so I figured I'd just sort the collection real quick before menu-izing it. This could be tweaked and cut around to make a good Add() method for your own sorted collection class.
Instructions: Copy the declarations and code below and paste directly into your VB project.