Load a Control Dynamically at Run Time

Category:
Forms and Controls
Type:
Snippets
Difficulty:
Beginning
Author:
Intelligent Solutions Inc.

Version Compatibility: Visual Basic 6

More information:
This example uses the ControlExtender object (added to VB starting with version 6.0) to dynamically load a control at run time, even if the control is not part of a control array. It works with both UserControls and built-in controls. An explanation and example is included in the comments.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: