Visual Basic/Event-Driven Design
INTRODUCTION In Event-Driven design one prepares the program in such a way that certain actions are taken only when an event occurs at the user's initiative or otherwise such as click of a button, or completion of a time interval etc.
Visual Basic 6.0 offers a wide variety of events to program. Some of the events are common for most of the controls whereas some are specific to individual controls. Some most common events are as follows:
In Visual Basic, the strength of any graphical or non-graphical control is measured by the kind of special events it provides to a program.
Advantages of event-driven programming: Event-driven programming is often termed as unstructured programming as it can never be said which piece of code will get executed unless we know which event occurred. But this very fact contributes to the major advantage of event-driven programming. With this approach, we can be sure of some components of a program (or software for that matter) running successfully while we work on others.
Another advantage associated with it is the convenience offered to both the end-user and the programmer. Events can be initiated by the user (like clicking a button). So it gives the user a feel of control over the system. On the other hand, programmer can put some very crucial code for very crucial events such as loading of a form, where several initializations and checks can be performed.