Wednesday, 22 August 2018

Event Driven Programming

Visual Basic programs are built around events. Events are various things that can happen in a program. this will
become clearer when studied in contrast to procedural programming. In procedural languages, an application is
written is executed by checking for the program logically through the program statements, one after another.
For a temporary phase, the control may be transferred to some other point in a program. While in an event
driven application, the program statements are executed only when a particular event calls a specific part of the
code that is assigned to the event.
Let us consider a TextBox control and a few of its associated events to understand the concept of event driven
programming. The TextBox control supports various events such as Change, Click, MouseMove and many
more that will be listed in the Properties dropdown list in the code window for the TextBox control. We will
look into a few of them as given below.
 The code entered in the Change event fires when there is a change in the contents of the TextBox
 The Click event fires when the TextBox control is clicked.
 The MouseMove event fires when the mouse is moved over the TextBox
As explained above, several events are associated with different controls and forms, some of the events being
common to most of them and few being specific to each control.

No comments:

Post a Comment