Dragging Objects to Create Data-Bound Controls

The process of creating and binding a control can be simplified by dragging a Command or Field object from the Data Environment designer and dropping it onto a Visual Basic form or report.

When this is done, Visual Basic creates a control with the DataSource, DataMember, and, if appropriate, DataField properties automatically set. The control created is based on the field mapping information specified in the DataEnvironment object. In addition, if specified, a label is automatically created.

Dragging Objects from Your Data Environment Designer to a Form

The section below explains how the Data Environment determines what control should be created.

To drag Field or Command objects onto a Data Report, see Creating a Simple Data Report.

To drag a Field or Command object onto a form

  1. Select a Field or Command object from the Data Environment designer. To select all Field objects within a Command object, select the Command object.

  2. Drag the selected Field or Command object from the Data Environment designer to the form.

    Each item dragged to the form creates a data-bound control that is based on the control associated with its source object. The dragged object's property setting links to the source object in the Data Environment.

To create a grid from a Command object

  1. Select a Command object and right-drag it onto a Visual Basic form.

  2. Select an option from the menu: Data Grid, multiple-bound controls, or any control associated with the multiple setting.