다음을 통해 공유


방법: Windows Forms BindingNavigator 컨트롤을 사용하여 데이터 탐색

Windows Forms에서 BindingNavigator 컨트롤을 사용하면 개발자가 폼을 만들어 간단하게 데이터를 탐색하고 조작할 수 있는 사용자 인터페이스를 최종 사용자에게 제공할 수 있습니다.

BindingNavigator 컨트롤은 데이터 집합에 있는 첫 번째 레코드, 마지막 레코드, 다음 레코드 및 이전 레코드를 탐색할 수 있도록 미리 구성된 단추와 함께 레코드를 추가하거나 삭제할 수 있는 단추가 있는 ToolStrip 컨트롤입니다. BindingNavigator 컨트롤은 ToolStrip 컨트롤이기 때문에 단추가 쉽게 추가됩니다. 자세한 내용은 다음을 참조하십시오. 방법: Windows Forms BindingNavigator 컨트롤에 로드, 저장 및 취소 단추 추가방법: Windows Forms BindingNavigator 컨트롤에 로드, 저장 및 취소 단추 추가방법: Windows Forms BindingNavigator 컨트롤에 로드, 저장 및 취소 단추 추가방법: Windows Forms BindingNavigator 컨트롤에 로드, 저장 및 취소 단추 추가.

BindingNavigator 컨트롤의 각 단추마다 프로그래밍 방식으로 같은 기능을 사용할 수 있는 해당 BindingSource 구성 요소 멤버가 있습니다. 예를 들어, MoveFirstItem 단추는 BindingSource 구성 요소의 MoveFirst 메서드에 해당하고 DeleteItem 단추는 RemoveCurrent 메서드에 해당합니다. 따라서 데이터 레코드를 탐색할 수 있도록 BindingNavigator 컨트롤을 활성화하는 것은 BindingSource 속성을 폼의 해당 BindingSource 구성 요소로 설정하는 것만큼 간단합니다.

BindingNavigator 컨트롤을 설정하려면

  1. BindingSource 구성 요소인 bindingSource1과 두 개의 TextBox 컨트롤 textBox1 및 textBox2를 추가합니다.

  2. 데이터에 bindingSource1을 바인딩하고 bindingSource1에 텍스트 상자 컨트롤을 바인딩합니다. 이렇게 하려면 다음 코드를 폼에 붙여넣고 폼의 생성자 또는 Load 이벤트 처리 메서드에서 LoadData를 호출합니다.

    Private Sub LoadData() 
        ' The xml to bind to.
        Dim xml As String = "<US><states>" + "<state><name>Washington</name><capital>Olympia</capital></state>" + "<state><name>Oregon</name><capital>Salem</capital></state>" + "<state><name>California</name><capital>Sacramento</capital></state>" + "<state><name>Nevada</name><capital>Carson City</capital></state>" + "</states></US>"
    
        ' Convert the xml string to bytes and load into a memory stream.
        Dim xmlBytes As Byte() = Encoding.UTF8.GetBytes(xml)
        Dim stream As New MemoryStream(xmlBytes, False)
    
        ' Create a DataSet and load the xml into it.
        Dim [set] As New DataSet()
        [set].ReadXml(stream)
    
        ' Set the DataSource to the DataSet, and the DataMember
        ' to state.
        bindingSource1.DataSource = [set]
        bindingSource1.DataMember = "state"
    
        textBox1.DataBindings.Add("Text", bindingSource1, "name")
        textBox2.DataBindings.Add("Text", bindingSource1, "capital")
    
    End Sub 'LoadData
    
    
    private void LoadData()
    {
        // The xml to bind to.
        string xml = @"<US><states>"
            + @"<state><name>Washington</name><capital>Olympia</capital></state>"
            + @"<state><name>Oregon</name><capital>Salem</capital></state>"
            + @"<state><name>California</name><capital>Sacramento</capital></state>"
            + @"<state><name>Nevada</name><capital>Carson City</capital></state>"
            + @"</states></US>";
    
        // Convert the xml string to bytes and load into a memory stream.
        byte[] xmlBytes = Encoding.UTF8.GetBytes(xml);
        MemoryStream stream = new MemoryStream(xmlBytes, false);
    
        // Create a DataSet and load the xml into it.
        DataSet set = new DataSet();
        set.ReadXml(stream);
    
        // Set the DataSource to the DataSet, and the DataMember
        // to state.
        bindingSource1.DataSource = set;
        bindingSource1.DataMember = "state";
    
        textBox1.DataBindings.Add("Text", bindingSource1, "name");
        textBox2.DataBindings.Add("Text", bindingSource1, "capital");
    
    }
    
  3. 폼에 BindingNavigator 컨트롤인 bindingNavigator1을 추가합니다.

  4. bindingNavigator1의 BindingSource 속성을 bindingSource1로 설정합니다. 디자이너를 사용하거나 코드로 이 작업을 수행할 수 있습니다.

    bindingNavigator1.BindingSource = bindingSource1
    
    bindingNavigator1.BindingSource = bindingSource1;
    

예제

다음 코드 예제는 위에서 설명한 단계에 대한 완전한 예제입니다.

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Xml
Imports System.IO
Imports System.Text



Class Form1
    Inherits Form
    Private components As IContainer
    Private bindingNavigator1 As BindingNavigator
    Private bindingNavigatorAddNewItem As ToolStripButton
    Private bindingNavigatorCountItem As ToolStripLabel
    Private bindingNavigatorDeleteItem As ToolStripButton
    Private bindingNavigatorMoveFirstItem As ToolStripButton
    Private bindingNavigatorMovePreviousItem As ToolStripButton
    Private bindingNavigatorSeparator As ToolStripSeparator
    Private bindingNavigatorPositionItem As ToolStripTextBox
    Private bindingNavigatorSeparator1 As ToolStripSeparator
    Private bindingNavigatorMoveNextItem As ToolStripButton
    Private bindingNavigatorMoveLastItem As ToolStripButton
    Private textBox1 As TextBox
    Private textBox2 As TextBox
    Private bindingSource1 As BindingSource
    Private bindingNavigatorSeparator2 As ToolStripSeparator


    Public Sub New() 
        InitializeComponent()
        LoadData()

        bindingNavigator1.BindingSource = bindingSource1

    End Sub 'New
    Private Sub LoadData() 
        ' The xml to bind to.
        Dim xml As String = "<US><states>" + "<state><name>Washington</name><capital>Olympia</capital></state>" + "<state><name>Oregon</name><capital>Salem</capital></state>" + "<state><name>California</name><capital>Sacramento</capital></state>" + "<state><name>Nevada</name><capital>Carson City</capital></state>" + "</states></US>"

        ' Convert the xml string to bytes and load into a memory stream.
        Dim xmlBytes As Byte() = Encoding.UTF8.GetBytes(xml)
        Dim stream As New MemoryStream(xmlBytes, False)

        ' Create a DataSet and load the xml into it.
        Dim [set] As New DataSet()
        [set].ReadXml(stream)

        ' Set the DataSource to the DataSet, and the DataMember
        ' to state.
        bindingSource1.DataSource = [set]
        bindingSource1.DataMember = "state"

        textBox1.DataBindings.Add("Text", bindingSource1, "name")
        textBox2.DataBindings.Add("Text", bindingSource1, "capital")

    End Sub 'LoadData

    <STAThread()>  _
    Public Shared Sub Main() 
        Application.EnableVisualStyles()
        Application.Run(New Form1())

    End Sub 'Main


    Private Sub InitializeComponent() 
        Me.components = New System.ComponentModel.Container()
        Dim resources As New System.ComponentModel.ComponentResourceManager(GetType(Form1))
        Me.bindingNavigator1 = New System.Windows.Forms.BindingNavigator(Me.components)
        Me.bindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
        Me.bindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator()
        Me.bindingNavigatorPositionItem = New System.Windows.Forms.ToolStripTextBox()
        Me.bindingNavigatorSeparator1 = New System.Windows.Forms.ToolStripSeparator()
        Me.bindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton()
        Me.bindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator()
        Me.textBox1 = New System.Windows.Forms.TextBox()
        Me.textBox2 = New System.Windows.Forms.TextBox()
        Me.bindingSource1 = New System.Windows.Forms.BindingSource(Me.components)
        CType(Me.bindingNavigator1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.bindingNavigator1.SuspendLayout()
        CType(Me.bindingSource1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        ' 
        ' bindingNavigator1
        ' 
        Me.bindingNavigator1.AddNewItem = Me.bindingNavigatorAddNewItem
        Me.bindingNavigator1.CountItem = Me.bindingNavigatorCountItem
        Me.bindingNavigator1.CountItemFormat = "of {0}"
        Me.bindingNavigator1.DeleteItem = Me.bindingNavigatorDeleteItem
        Me.bindingNavigator1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.bindingNavigatorMoveFirstItem, Me.bindingNavigatorMovePreviousItem, Me.bindingNavigatorSeparator, Me.bindingNavigatorPositionItem, Me.bindingNavigatorCountItem, Me.bindingNavigatorSeparator1, Me.bindingNavigatorMoveNextItem, Me.bindingNavigatorMoveLastItem, Me.bindingNavigatorSeparator2, Me.bindingNavigatorAddNewItem, Me.bindingNavigatorDeleteItem})
        Me.bindingNavigator1.Location = New System.Drawing.Point(0, 0)
        Me.bindingNavigator1.MoveFirstItem = Me.bindingNavigatorMoveFirstItem
        Me.bindingNavigator1.MoveLastItem = Me.bindingNavigatorMoveLastItem
        Me.bindingNavigator1.MoveNextItem = Me.bindingNavigatorMoveNextItem
        Me.bindingNavigator1.MovePreviousItem = Me.bindingNavigatorMovePreviousItem
        Me.bindingNavigator1.Name = "bindingNavigator1"
        Me.bindingNavigator1.PositionItem = Me.bindingNavigatorPositionItem
        Me.bindingNavigator1.TabIndex = 2
        Me.bindingNavigator1.Text = "bindingNavigator1"
        ' 
        ' bindingNavigatorAddNewItem
        ' 
        Me.bindingNavigatorAddNewItem.Image = CType(resources.GetObject("bindingNavigatorAddNewItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem"
        Me.bindingNavigatorAddNewItem.Text = "Add new"
        ' 
        ' bindingNavigatorCountItem
        ' 
        Me.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem"
        Me.bindingNavigatorCountItem.Text = "of {0}"
        Me.bindingNavigatorCountItem.ToolTipText = "Total number of items"
        ' 
        ' bindingNavigatorDeleteItem
        ' 
        Me.bindingNavigatorDeleteItem.Image = CType(resources.GetObject("bindingNavigatorDeleteItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem"
        Me.bindingNavigatorDeleteItem.Text = "Delete"
        ' 
        ' bindingNavigatorMoveFirstItem
        ' 
        Me.bindingNavigatorMoveFirstItem.Image = CType(resources.GetObject("bindingNavigatorMoveFirstItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem"
        Me.bindingNavigatorMoveFirstItem.Text = "Move first"
        ' 
        ' bindingNavigatorMovePreviousItem
        ' 
        Me.bindingNavigatorMovePreviousItem.Image = CType(resources.GetObject("bindingNavigatorMovePreviousItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem"
        Me.bindingNavigatorMovePreviousItem.Text = "Move previous"
        ' 
        ' bindingNavigatorSeparator
        ' 
        Me.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator"

        ' 
        ' bindingNavigatorPositionItem
        ' 
        Me.bindingNavigatorPositionItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
        Me.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem"
        Me.bindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 25)
        Me.bindingNavigatorPositionItem.Text = "0"
        Me.bindingNavigatorPositionItem.ToolTipText = "Current position"
        ' 
        ' bindingNavigatorSeparator1
        ' 
        Me.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1"
            ' 
        ' bindingNavigatorMoveNextItem
        ' 
        Me.bindingNavigatorMoveNextItem.Image = CType(resources.GetObject("bindingNavigatorMoveNextItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem"
        Me.bindingNavigatorMoveNextItem.Text = "Move next"
        ' 
        ' bindingNavigatorMoveLastItem
        ' 
        Me.bindingNavigatorMoveLastItem.Image = CType(resources.GetObject("bindingNavigatorMoveLastItem.Image"), System.Drawing.Image)
        Me.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem"
        Me.bindingNavigatorMoveLastItem.Text = "Move last"
        ' 
        ' bindingNavigatorSeparator2
        ' 
        Me.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2"

        ' 
        ' textBox1
        ' 
        Me.textBox1.Location = New System.Drawing.Point(46, 64)
        Me.textBox1.Name = "textBox1"
        Me.textBox1.TabIndex = 3
        ' 
        ' textBox2
        ' 
        Me.textBox2.Location = New System.Drawing.Point(46, 104)
        Me.textBox2.Name = "textBox2"
        Me.textBox2.TabIndex = 4
        ' 
        ' Form1
        ' 
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.Add(textBox2)
        Me.Controls.Add(textBox1)
        Me.Controls.Add(bindingNavigator1)
        Me.Name = "Form1"
        CType(Me.bindingNavigator1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.bindingNavigator1.ResumeLayout(False)
        Me.bindingNavigator1.PerformLayout()
        CType(Me.bindingSource1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub 'InitializeComponent
End Class 'Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using System.IO;
using System.Text;

namespace System.Windows.Forms.BindingSourceCurrent
{
    class Form1 : Form
    {
        private IContainer components;
        private BindingNavigator bindingNavigator1;
        private ToolStripButton bindingNavigatorAddNewItem;
        private ToolStripLabel bindingNavigatorCountItem;
        private ToolStripButton bindingNavigatorDeleteItem;
        private ToolStripButton bindingNavigatorMoveFirstItem;
        private ToolStripButton bindingNavigatorMovePreviousItem;
        private ToolStripSeparator bindingNavigatorSeparator;
        private ToolStripTextBox bindingNavigatorPositionItem;
        private ToolStripSeparator bindingNavigatorSeparator1;
        private ToolStripButton bindingNavigatorMoveNextItem;
        private ToolStripButton bindingNavigatorMoveLastItem;
        private TextBox textBox1;
        private TextBox textBox2;
        private BindingSource bindingSource1;
        private ToolStripSeparator bindingNavigatorSeparator2;

        public Form1()
        {
            InitializeComponent();
            LoadData();

            bindingNavigator1.BindingSource = bindingSource1;

        }
        private void LoadData()
        {
            // The xml to bind to.
            string xml = @"<US><states>"
                + @"<state><name>Washington</name><capital>Olympia</capital></state>"
                + @"<state><name>Oregon</name><capital>Salem</capital></state>"
                + @"<state><name>California</name><capital>Sacramento</capital></state>"
                + @"<state><name>Nevada</name><capital>Carson City</capital></state>"
                + @"</states></US>";

            // Convert the xml string to bytes and load into a memory stream.
            byte[] xmlBytes = Encoding.UTF8.GetBytes(xml);
            MemoryStream stream = new MemoryStream(xmlBytes, false);

            // Create a DataSet and load the xml into it.
            DataSet set = new DataSet();
            set.ReadXml(stream);

            // Set the DataSource to the DataSet, and the DataMember
            // to state.
            bindingSource1.DataSource = set;
            bindingSource1.DataMember = "state";

            textBox1.DataBindings.Add("Text", bindingSource1, "name");
            textBox2.DataBindings.Add("Text", bindingSource1, "capital");

        }

        [STAThread]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = 
                new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.bindingNavigator1 = new System.Windows.Forms.BindingNavigator(this.components);
            this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel();
            this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorMovePreviousItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorSeparator = new System.Windows.Forms.ToolStripSeparator();
            this.bindingNavigatorPositionItem = new System.Windows.Forms.ToolStripTextBox();
            this.bindingNavigatorSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton();
            this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.bindingNavigator1)).BeginInit();
            this.bindingNavigator1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
            this.SuspendLayout();
            // 
            // bindingNavigator1
            // 
            this.bindingNavigator1.AddNewItem = this.bindingNavigatorAddNewItem;
            this.bindingNavigator1.CountItem = this.bindingNavigatorCountItem;
            this.bindingNavigator1.CountItemFormat = "of {0}";
            this.bindingNavigator1.DeleteItem = this.bindingNavigatorDeleteItem;
            this.bindingNavigator1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.bindingNavigatorMoveFirstItem,
            this.bindingNavigatorMovePreviousItem,
            this.bindingNavigatorSeparator,
            this.bindingNavigatorPositionItem,
            this.bindingNavigatorCountItem,
            this.bindingNavigatorSeparator1,
            this.bindingNavigatorMoveNextItem,
            this.bindingNavigatorMoveLastItem,
            this.bindingNavigatorSeparator2,
            this.bindingNavigatorAddNewItem,
            this.bindingNavigatorDeleteItem});
            this.bindingNavigator1.Location = new System.Drawing.Point(0, 0);
            this.bindingNavigator1.MoveFirstItem = this.bindingNavigatorMoveFirstItem;
            this.bindingNavigator1.MoveLastItem = this.bindingNavigatorMoveLastItem;
            this.bindingNavigator1.MoveNextItem = this.bindingNavigatorMoveNextItem;
            this.bindingNavigator1.MovePreviousItem = this.bindingNavigatorMovePreviousItem;
            this.bindingNavigator1.Name = "bindingNavigator1";
            this.bindingNavigator1.PositionItem = this.bindingNavigatorPositionItem;
            this.bindingNavigator1.TabIndex = 2;
            this.bindingNavigator1.Text = "bindingNavigator1";
            // 
            // bindingNavigatorAddNewItem
            // 
            this.bindingNavigatorAddNewItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorAddNewItem.Image")));
            this.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem";
            this.bindingNavigatorAddNewItem.Text = "Add new";
            // 
            // bindingNavigatorCountItem
            // 
            this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
            this.bindingNavigatorCountItem.Text = "of {0}";
            this.bindingNavigatorCountItem.ToolTipText = "Total number of items";
            // 
            // bindingNavigatorDeleteItem
            // 
            this.bindingNavigatorDeleteItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorDeleteItem.Image")));
            this.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem";
            this.bindingNavigatorDeleteItem.Text = "Delete";
            // 
            // bindingNavigatorMoveFirstItem
            // 
            this.bindingNavigatorMoveFirstItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveFirstItem.Image")));
            this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
            this.bindingNavigatorMoveFirstItem.Text = "Move first";
            // 
            // bindingNavigatorMovePreviousItem
            // 
            this.bindingNavigatorMovePreviousItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMovePreviousItem.Image")));
            this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
            this.bindingNavigatorMovePreviousItem.Text = "Move previous";
            // 
            // bindingNavigatorSeparator
            // 
            this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
            // 
            // bindingNavigatorPositionItem
            // 
            this.bindingNavigatorPositionItem.DisplayStyle = 
                System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
            this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
            this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 25);
            this.bindingNavigatorPositionItem.Text = "0";
            this.bindingNavigatorPositionItem.ToolTipText = "Current position";
            // 
            // bindingNavigatorSeparator1
            // 
            this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1";

        // bindingNavigatorMoveNextItem
            // 
            this.bindingNavigatorMoveNextItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveNextItem.Image")));
            this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
            this.bindingNavigatorMoveNextItem.Text = "Move next";
            // 
            // bindingNavigatorMoveLastItem
            // 
            this.bindingNavigatorMoveLastItem.Image = 
                ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveLastItem.Image")));
            this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
            this.bindingNavigatorMoveLastItem.Text = "Move last";
            // 
            // bindingNavigatorSeparator2
            // 
            this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2";
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(46, 64);
            this.textBox1.Name = "textBox1";
            this.textBox1.TabIndex = 3;
            // 
            // textBox2
            // 
            this.textBox2.Location = new System.Drawing.Point(46, 104);
            this.textBox2.Name = "textBox2";
            this.textBox2.TabIndex = 4;
            // 
            // Form1
            // 
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.textBox2);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.bindingNavigator1);
            this.Name = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.bindingNavigator1)).EndInit();
            this.bindingNavigator1.ResumeLayout(false);
            this.bindingNavigator1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
    }
}

코드 컴파일

이 예제에는 다음 사항이 필요합니다.

  • System, System.Data, System.Drawing, System.Windows.Forms 및 System.Xml 어셈블리에 대한 참조

Visual Basic 또는 Visual C#의 명령줄에서 이 예제를 빌드하는 방법에 대한 자세한 내용은 명령줄에서 빌드(Visual Basic) 또는 csc.exe를 사용한 명령줄 빌드를 참조하십시오. Visual Studio에서 코드를 새 프로젝트에 붙여넣어 이 예제를 빌드할 수도 있습니다. 자세한 내용은 다음을 참조하십시오. 방법: Visual Studio를 사용하여 전체 Windows Forms 코드 예제 컴파일 및 실행방법: Visual Studio를 사용하여 전체 Windows Forms 코드 예제 컴파일 및 실행방법: Visual Studio를 사용하여 전체 Windows Forms 코드 예제 컴파일 및 실행방법: Visual Studio를 사용하여 전체 Windows Forms 코드 예제 컴파일 및 실행방법: Visual Studio를 사용하여 전체 Windows Forms 코드 예제 컴파일 및 실행.

참고 항목

참조

BindingNavigator

기타 리소스

BindingNavigator 컨트롤(Windows Forms)

ToolStrip 컨트롤(Windows Forms)