Object Events Summary
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Object Events Summary
■ Events are used with forms and controls to detect and perform actions.
When a valid event is detected, a special SUB procedure (called an event
handler or event procedure) is invoked. Visual Basic supports several
common events, including the detection of keystrokes, button clicks, and
mouse clicks.
■ In earlier versions of Microsoft Basic, event statements were used to
detect events from module-level code. The occurrence of an event caused
the program to jump (using a GOSUB statement) to a particular line label
at the module level. This type of event-handling functionality is
included in Visual Basic for compatibility only. Use object-specific
events with forms. See: ◄Error/Event Trapping Summary►
■ Each event applies to a specific set of objects. A list of applicable
objects is defined in the Help topic for each individual event.
■ Use the following syntax for form events:
SUB Form_event ()
• event Name of the event
■ Use the following syntax for control events:
SUB ctlname_event ([Index AS INTEGER])
• ctlname Any valid control name
• event Name of the event
• Index Identifies which control receives the event in a
control array
■ The following events are available in Visual Basic:
◄Change► Change the value of a control
◄Click► Click a form or control
◄DblClick► Double-click a form or control
◄DragDrop► Drag and drop an object on a control
◄DragOver► Drag an object over a control
◄DropDown► Imminent drop-down of menu or list portion of combo box
◄GotFocus► Form or control receives the focus
◄KeyDown► Key is pressed down while a form or control has focus
◄KeyPress► ASCII-representable key is pressed
◄KeyUp► Key is released while a form or control has the focus
◄Load► Form is created and loaded into memory
◄LostFocus► Form or control loses the focus
◄MouseDown► Mouse button is pressed
◄MouseMove► Mouse is moved
◄MouseUp► Mouse button is released
◄Paint► Form or control is painted
◄PathChange► Assignment causes the drive path to change
◄PatternChange► Assignment causes the file pattern to change
◄Resize► Form is resized
◄Timer► Time limit set by Interval property is reached
◄Unload► Form is removed from memory
See Also
◄Controls Summary► ◄Form►
◄Methods Summary► ◄Properties Summary►