This was my first ActiveX control. I wanted to add the
virtual (or owner-data)
capabilities of the ListView control to the Visual Basic programmer.
The virtual control can handle an outrageous number of items. Specifically, the control can support an item count up to 4 billion. This is possible because the overhead of managing item data is placed on the owner. Whenever the list control needs to display an item, it will ask the owner (e.g. the Visual Basic Form) about the displayed data.
The Virtual List control is just as easy to use as the regular List Control in Visual Basic. There are however some differences in the way you set the initial properties and how you manage your data.
How to use it
ItemCountFirst of all the
ItemCountproperty is read-write. You must initialise the control by setting this property to the expected number of items the control will display.
GetItem eventThe control has one important event that you must supply code for: the
GetItemevent. This event is fired whenever the control needs to paint a list item. You are responsible for looking up the item's text and return it. You can imagine that this event will fire a lot so careful management (caching) of your item data is important for performance.
Source Code DependenciesMicrosoft Visual C++ 6.0
Microsoft ATL Library
- Copy the OCX to a directory of your choice and register it using the REGSVR32 utility or use VB to browse for it.
|OCX File (37 Kb)|
Source Code (64 Kb)