Setting Event Handlers on ActiveX Controls

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Visual Studio 2017 Documentation. ActiveX controls can be programmed to respond to events. You can use ControlEvents in properties to view the events that are available in a control and to create event handlers. Event handling is commonly done to trap changes in the data source query. Changes include:

  • Implementing a lookup. When a control (like a DBCombo box) changes value, the change event is trapped to update a data control's query.

  • Implementing a master detail relationship. Two data controls are added to a dialog box, one for the master portion and a second for the detail portion. Whenever the first data source changes, the second data source's query is updated through an event handler.

  • Trapping errors. Most controls have an error event from which you can write an error handler (see Error Trapping).

For more information, see Mapping Messages to Functions.

See Also

Using ActiveX Controls