Code Samples, Tips, Tricks and
other Neat Stuff for the VB developer

All Content Copyright 2000
New Vision Software
All rights reserved

VB Petition

Many of you may not be aware that Microsoft's mainstream support for VB6 officially ended on March 31st, 2005.  Now that this has occurred, it becomes increasingly more likely that future updates to Windows may break existing VB code.  If you are concerned about this and/or are concerned about migration issues associated with bringing existing VB code to the .NET platform, please take a moment to read and sign the petition asking Microsoft to extend there COM based VB product line.  The impetus behind the petition is the desire to give companies and individuals with substantial investments in existing VB code a path forward to the latest development platform without the current requirement for wholesale rewrites of existing code.  Thanks for your support!




All Sample Projects

Grouped Samples

Common Dialogs

Control Stuff

Date & Timezone




File Routines

Form Modifications

Icon Routines

Listbox & ComboBox




Text Parsing Routines

UserControl Demos

Specific Samples

Activate Previous


API & OLE DragDrop

Environment Variables



Message Box



File Split Utility

Save Clipboard Utility

Visual Basic Tips!


The following articles deal with custom collection implementations.  The first explains how to create a fully functional replacement for the VB collection object and the second describes how to raise events from each of the objects in a collection just like events are raised in a VB control array.  The sample projects for each of the articles may be downloaded from the links on this page or on the pages containing the article texts.

Create Your Own "Super Collections" in VB

Raise Events From Items In Collections Just Like VB Control Arrays

More About CSuperCollection

The CSuperCollection implementation addresses just about all of the complaints I have ever heard about the VB collection object while maintaining the same functionality as the existing VB object.  It has several methods for managing keys including a keys object that can be enumerated using For Each...Next syntax and a KeyExists method.  Also present are a move method for items and the ability to assign directly to an item.  Something that may prove to be one of the most useful parts of this project is the ability to raise events from any item in the collection, through the collection, returning the index and the key of the item raising the event.

I have successfully replaced the VB collection object with CSuperCollection in several existing projects.  The replacement was much easier than I expected with very little code alteration required.  I hope you find CSuperCollection as useful as I have.

Enumerator Fun!

Have you ever wondered what goes on under the hood when you execute a For Each...Next loop in VB?  Well, the Enumerator Fun sample project shows you how to do an enumeration loop the hard way.  The neat part of enumerating a collection in this manner is that you can access all of the methods of the enumerator object used to walk the collection.  This gives you much more flexibility in how you access the items in a collection.  Have a look at the Enumerator Fun sample project for more details.

Download the CSuperCollection sample project  (27KB)

Download the Collection WithEvents sample project  (8KB)