Adding Buttons to a DataWindow Object

Button controls make it easy to provide command button actions in a DataWindow object. No coding is required.

The use of Button controls in the DataWindow object, instead of CommandButton controls in a window, ensures that actions appropriate to the DataWindow object are included in the object itself.

The Button control is a command or picture button that you can place in a DataWindow object. When clicked at runtime, the button activates either a built-in or user-supplied action.

For example, you can place a button in a report and specify that clicking it opens the Filter dialog box, where users can specify a filter to be applied to the currently retrieved data.

Note: Do not use a message box in the Clicked event. If you call the MessageBox function in the Clicked event, the action assigned to the button is executed, but the ButtonClicking and ButtonClicked events are not executed.
  1. In the Toolbox, click the Button control.
  2. Click where you want the button to appear.
    You may find it useful to put a Delete button or an Insert button in the detail band. Clicking a Delete button in the detail band deletes the row next to the button. Clicking an Insert button in the detail band inserts a row following the current row.
    Note: Buttons in the detail band repeat for every row of data, which is not always desirable. Buttons in the detail band are not visible during retrieval, so a Cancel button in the detail band would be unavailable when needed.
  3. In the General category of the Properties view, enter the text for the button.
  4. Select the action you want to assign to the button.