Share via


How to: Scroll Through Database Records in a Worksheet

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Excel 2007

  • Excel 2003

For more information, see Features Available by Application and Project Type.

The following procedure shows how to use the designer to display a single field from a database table in a Microsoft Office Excel worksheet, with controls that enable the end user to scroll through all the records.

You can use the designer only in document-level projects. Starting in Visual Studio 2008 Service Pack 1 (SP1), you can add controls and bind them to data programmatically at run time. For more information, see Walkthrough: Simple Data Binding in an Application-Level Project.

To scroll through database records in a worksheet

  1. Open an Excel application project in Visual Studio.

  2. Open the Data Sources window and create a data source from the database. For more information, see How to: Connect to Data in a Database.

  3. Expand the table that contains the data that you want to show, and select the specific column.

  4. Open the list of controls and select NamedRange.

  5. Drag the NamedRange control onto the cell where you want the data to appear.

  6. From the Windows Forms tab of the Toolbox, add a BindingNavigator control to your worksheet, and set up the controls you want to use. For more information, see BindingNavigator Control Overview (Windows Forms).

See Also

Concepts

Binding Data to Controls in Office Solutions

Change History

Date

History

Reason

July 2008

Added information about binding data in application-level add-ins.

SP1 feature change.