Visual Basic Reference

Initialize Event

See Also    Example    Applies To

Occurs when an application creates an instance of a Form, MDIForm, User control, Property Page, Webclass, DHTML Page Designer, or class.

Syntax

Private Sub object**_Initialize( )**

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

You trigger the Initialize event when you:

  • Use the CreateObject function to create an instance of a class. For example:

    Set X = CreateObject("Project1.MyClass")
    
  • Refer to a property or event of an automatically created instance of a form or class in your code. For example:

    MyForm.Caption = "Example"
    

Use this event to initialize any data used by the instance of the Form, MDIForm, or class. For a Form or MDIForm, the Initialize event occurs before the Load event.