Monday, December 10, 2012

Event Driven Programming


Event Driven Programming

Event-procedures are Visual Basic procedures that respond to events and are automatically generated by the Visual Basic. Visual Basic is based upon an event-driven paradigm, in which each feature included within the program is activated only when the user responds to a corresponding object (i.e., an icon, a checkbox, an option button, a menu selection, etc.) within the user interface. The programmer adds code to respond to specific events, and only events that are relevant to a program need be coded. The group of Basic commands that brings about this response is called an event-procedure.

Keyboard Events
onkeydown     When a keyboard key is pressed
onkeypress      When a keyboard key is pressed and released
onkeyup          When a keyboard key is released
Change            The Change event is generated each time a new character is typed or deleted.

Mouse Events
onclick                         When an object is clicked with the mouse
ondblclick       When an object is double-clicked with the mouse
onmousedown             When the mouse is clicked on an object
onmousemove When the mouse is moved
onmouseup      When the mouse button is released