Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 6

The Initialize Event

The Initialize event fires when an instance of the form is created in your application.

Initialize fires just before Load the very first time the form is loaded into memory during the application's current session. It may or may not fire before subsequent Loads of the form, depending on what else has happened:

  • If the form was previously loaded and then unloaded but was not un-instantiated by having its instance set to Nothing, the Initialize event will not fire the next time the form is loaded.

  • If the form was previously unloaded and then un-instantiated with

    Set formname = Nothing '(this also fires Terminate event)

    the Initialize event will fire the next time the form loads.

Forms have an Initialize event because Microsoft wants us to see forms as programmable, customizable object classes, and custom programmer-created VB classes always sport built-in Initialize and Terminate events.

You should therefore program a form's Initialize event procedure similar to the way you'd program a custom VB class' Initialize event procedure. That is, you should initialize custom form properties here. This might include setting the value of Public form variables (Public variables in a form are automatically properties of the form) or of Private variables (Private variables can store intermediate values of properties that are implemented with Property procedures).


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved