Creating ActiveX Objects Dynamically


You can create ActiveX objects programmatically instead of adding them to a form at design time. This allows your application to instantiate components only when needed and gives you more flexibility.

In Visual Basic, this can be done by adding a reference to the OCX via Tools->References.

Declare the object in your code:

Dim http1 As http

If you need to handle events from the component, declare it with events and then create an instance of the object when required:

Dim withevents http1 as http
set http1 = new http

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.