Event-Driven Design in VB6
From Wikiversity
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 commom for most of the controls whereas some are specific to individual controls. Some most commom events are as follows:
1. Click 2. MouseMove 3. KeyPress
In Visual Basic, the strenth of any graphical or non-graphical control is measuered by the kind of special events it provides to 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 occured. But this very fact contibutes 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.