Share via


BindingNavigator Control Sample

This sample demonstrates how to use a BindingNavigator control bound to a BindingSource component.

The BindingNavigator control derives from ToolStrip and contains a pre-populated set of buttons for navigating through data in a BindingSource component. The functionality behind these buttons is extensible. In this sample, the New button behavior is overridden.

For information about using the samples, see the following topics:

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build and run the sample using the command prompt

  1. At the command prompt, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the BindingNavigatorSample directory.

  3. Type msbuild to build the sample using the solution (.sln) file provided.

  4. Type cd BindingNavigatorSample\bin\Debug to navigate to the location of the executable file.

  5. Type BindingNavigatorSample.exe to run the sample.

To build and run the sample using Visual Studio

  1. In Windows Explorer, navigate to the location where you saved the uncompressed sample files.

  2. Navigate to one of the language-specific subdirectories under the BindingNavigatorSample directory.

  3. Double-click the solution (.sln) file to open it in Visual Studio.

  4. In Visual Studio, press F5 to build and run the sample.

To use the BindingNavigatorSample

  • Select a flag from the ComboBox control and click the plus (+) button to create a Flag object and add it to the BindingSource component. Use the arrow buttons on the BindingNavigator control to move through the Flag items you have added.

Demonstrates

  • Using BindingNavigator control to move through items in a data source.

  • Using a BindingSource component to bind Windows Forms controls to a data source.

See Also

Tasks

How to: Bind a Windows Forms Control to a Type

Reference

Panel
BindingSource
BindingNavigator
DataGridView
System.Collections.IList
System.ComponentModel.IBindingList
System.ComponentModel.IEditableObject