Visual Basic: DataRepeater Control
The DataRepeater control functions as a scrollable container of data-bound user controls. Each control appears in its own row as a "repeated" control, allowing the user to view several data-bound user controls at once.
To use the DataRepeater control, you must first create a data-bound user control, and compile it into an .ocx. After creating the user control, the following basic steps must be taken:
- Add the user control to the project using the Components dialog box. This ensures that appropriate files are included by the Visual Basic Package and Deployment Wizard. It also allows access to the control's public properties, events, and methods.
- On the Properties window, click RepeatedControlName and select the user control from the drop down list.
- Add a data source, such as the ADO Data Control, to the form, and connect it to a data provider.
- Set the DataRepeater control's DataSource property to the data source.
- Right-click the DataRepeater control and click DataRepeater Properties.
- Click the RepeaterBindings tab.
- Set the PropertyName to an appropriate DataField, and click the Add button.
The DataRepeater control saves computer resources by only displaying a single user control the active control at a time. The other controls displayed are simple images that do not maintain individual connections to the data source, as would happen if several user controls were contained on a form.
Distribution Note When you create and distribute applications that use the DataRepeater control, you should install MSDatRep.ocx in the customer's Microsoft Windows System or System32 subdirectory. The Setup Kit included with Visual Basic provides tools to help you write setup programs that install your applications correctly.