ActiveX Controls

If you have been using Microsoft Windows for some time (as we presume you have, since you are reading this book), then you are quite familiar with controls at the user level. The following are examples of controls:

• Command buttons

• Option buttons

All of these controls have a visual interface for interaction with the user. However, some controls do not have a visual interface. One example is the Timer control, which can be set to fire an event at regular intervals. Thus, the programmer can write code that will execute at regular intervals.

Generally speaking, a control (or ActiveX control ) can be thought of as a special type of code component that can be placed within a larger container object (such as a form) and has the following properties:

• Controls generally (but not always) provide a visual interface for communication with the user.

• Controls can have methods that can be invoked by the user.

• Controls can have properties that can be read and set by the user.

• Controls can have events for which the user can write event code.

We discussed events that are associated with Excel objects (worksheets, workbooks, charts, and so on) in Chapter 11. Control events work in precisely the same way, as we will see in the upcoming examples.

0 0

Post a comment