BindingNavigator.BindingSource Property

Gets or sets the System.Windows.Forms.BindingSource component that is the source of data.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public BindingSource BindingSource { get; set; }

Property Value

Type: System.Windows.Forms.BindingSource
The System.Windows.Forms.BindingSource component associated with this BindingNavigator. The default is null.

The BindingSource property represents the data source that the BindingNavigator navigates through. More specifically, the List property of the BindingSource represents the actual data list.

This is the default property for the BindingNavigator class.

The following code example demonstrates how to use a BindingNavigator control to move through a data set. The set is contained in a DataView, which is bound to a TextBox control with a BindingSource component. This code example is part of a larger example provided in How to: Move Through a DataSet with the Windows Forms BindingNavigator Control.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.SqlClient;
using System.Windows.Forms;

// This form demonstrates using a BindingNavigator to display  
// rows from a database query sequentially. 
public class Form1 : Form
    // This is the BindingNavigator that allows the user 
    // to navigate through the rows in a DataSet.
    BindingNavigator customersBindingNavigator = new BindingNavigator(true);

    // This is the BindingSource that provides data for 
    // the Textbox control.
    BindingSource customersBindingSource = new BindingSource();

    // This is the TextBox control that displays the CompanyName 
    // field from the the DataSet.
    TextBox companyNameTextBox = new TextBox();

    public Form1()
        // Set up the BindingSource component. 
        this.customersBindingNavigator.BindingSource = this.customersBindingSource;
        this.customersBindingNavigator.Dock = DockStyle.Top;

        // Set up the TextBox control for displaying company names. 
        this.companyNameTextBox.Dock = DockStyle.Bottom;

        // Set up the form. 
        this.Size = new Size(800, 200);
        this.Load += new EventHandler(Form1_Load);

    void Form1_Load(object sender, EventArgs e)
        // Open a connection to the database. 
        // Replace the value of connectString with a valid  
        // connection string to a Northwind database accessible  
        // to your system. 
        string connectString =
            "Integrated Security=SSPI;Persist Security Info=False;" +
            "Initial Catalog=Northwind;Data Source=localhost";

        using (SqlConnection connection = new SqlConnection(connectString))

            SqlDataAdapter dataAdapter1 = 
                new SqlDataAdapter(new SqlCommand("Select * From Customers",connection));
            DataSet ds = new DataSet("Northwind Customers");

            // Assign the DataSet as the DataSource for the BindingSource. 
            this.customersBindingSource.DataSource = ds.Tables["Customers"];

            // Bind the CompanyName field to the TextBox control. 
                new Binding("Text",

    public static void Main()
        Application.Run(new Form1());

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft