Binding Binding Binding Binding Class

정의

개체 속성 값과 컨트롤 속성 값 사이의 단순 바인딩을 나타냅니다.Represents the simple binding between the property value of an object and the property value of a control.

public ref class Binding
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ListBindingConverter))]
public class Binding
type Binding = class
Public Class Binding
상속
BindingBindingBindingBinding
특성

예제

다음 코드 예제는 단순 데이터 바인딩을 보여 주는 몇 가지 컨트롤을 사용 하 여 Windows Form을 만듭니다.The following code example creates a Windows Form with several controls that demonstrate simple data binding. 이 예에서는 만듭니다는 DataSet 라는 두 개의 테이블을 사용 하 여 CustomersOrders, 및 DataRelation 라는 custToOrders합니다.The example creates a DataSet with two tables named Customers and Orders, and a DataRelation named custToOrders. 네 가지 컨트롤 (한 DateTimePicker 및 3 TextBox 컨트롤) 데이터 테이블의 열에 바인딩된 합니다.Four controls (a DateTimePicker and three TextBox controls) are data bound to columns in the tables. 각 컨트롤에 대 한 예제를 만들고 추가 Binding 를 통해 컨트롤을 DataBindings 속성입니다.For each control, the example creates and adds a Binding to the control through the DataBindings property. 반환 하는 예제는 BindingManagerBase 폼의를 통해 각 테이블에 대해 BindingContext합니다.The example returns a BindingManagerBase for each table through the form's BindingContext. 4 Button 증가 또는 감소를 제어 합니다 Position 속성에는 BindingManagerBase 개체.Four Button controls increment or decrement the Position property on the BindingManagerBase objects.

#using <system.dll>
#using <system.data.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
#using <system.xml.dll>

using namespace System;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Globalization;
using namespace System::Windows::Forms;

#define null 0L
public ref class Form1: public Form
{
private:
   System::ComponentModel::Container^ components;
   Button^ button1;
   Button^ button2;
   Button^ button3;
   Button^ button4;
   TextBox^ text1;
   TextBox^ text2;
   TextBox^ text3;
   BindingManagerBase^ bmCustomers;
   BindingManagerBase^ bmOrders;
   DataSet^ ds;
   DateTimePicker^ DateTimePicker1;

public:
   Form1()
   {
      // Required for Windows Form Designer support.
      InitializeComponent();

      // Call SetUp to bind the controls.
      SetUp();
   }

private:
   void InitializeComponent()
   {
      // Create the form and its controls.
      this->components = gcnew System::ComponentModel::Container;
      this->button1 = gcnew Button;
      this->button2 = gcnew Button;
      this->button3 = gcnew Button;
      this->button4 = gcnew Button;
      this->text1 = gcnew TextBox;
      this->text2 = gcnew TextBox;
      this->text3 = gcnew TextBox;
      this->DateTimePicker1 = gcnew DateTimePicker;
      this->Text =  "Binding Sample";
      this->ClientSize = System::Drawing::Size( 450, 200 );
      button1->Location = System::Drawing::Point( 24, 16 );
      button1->Size = System::Drawing::Size( 64, 24 );
      button1->Text =  "<";
      button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
      button2->Location = System::Drawing::Point( 90, 16 );
      button2->Size = System::Drawing::Size( 64, 24 );
      button2->Text =  ">";
      button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click );
      button3->Location = System::Drawing::Point( 90, 100 );
      button3->Size = System::Drawing::Size( 64, 24 );
      button3->Text =  "<";
      button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click );
      button4->Location = System::Drawing::Point( 150, 100 );
      button4->Size = System::Drawing::Size( 64, 24 );
      button4->Text =  ">";
      button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click );
      text1->Location = System::Drawing::Point( 24, 50 );
      text1->Size = System::Drawing::Size( 150, 24 );
      text2->Location = System::Drawing::Point( 190, 50 );
      text2->Size = System::Drawing::Size( 150, 24 );
      text3->Location = System::Drawing::Point( 290, 150 );
      text3->Size = System::Drawing::Size( 150, 24 );
      DateTimePicker1->Location = System::Drawing::Point( 90, 150 );
      DateTimePicker1->Size = System::Drawing::Size( 200, 800 );
      this->Controls->Add( button1 );
      this->Controls->Add( button2 );
      this->Controls->Add( button3 );
      this->Controls->Add( button4 );
      this->Controls->Add( text1 );
      this->Controls->Add( text2 );
      this->Controls->Add( text3 );
      this->Controls->Add( DateTimePicker1 );
   }

public:
   ~Form1()
   {
      if ( components != nullptr )
      {
         delete components;
      }
   }

private:
   void SetUp()
   {
      // Create a DataSet with two tables and one relation.
      MakeDataSet();
      BindControls();
   }

protected:
   void BindControls()
   {
      /* Create two Binding objects for the first two TextBox 
              controls. The data-bound property for both controls 
              is the Text property. The data source is a DataSet 
              (ds). The data member is the 
              "TableName.ColumnName" string. */
      text1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) );
      text2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) );

      /* Bind the DateTimePicker control by adding a new Binding. 
              The data member of the DateTimePicker is a 
              TableName.RelationName.ColumnName string. */
      DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) );

      /* Add event delegates for the Parse and Format events to a 
              new Binding object, and add the object to the third 
              TextBox control's BindingsCollection. The delegates 
              must be added before adding the Binding to the 
              collection; otherwise, no formatting occurs until 
              the Current object of the BindingManagerBase for 
              the data source changes. */
      Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" );
      b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal );
      b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString );
      text3->DataBindings->Add( b );

      // Get the BindingManagerBase for the Customers table. 
      bmCustomers = this->BindingContext[ ds, "Customers" ];

      /* Get the BindingManagerBase for the Orders table using the 
              RelationName. */
      bmOrders = this->BindingContext[ ds, "customers.CustToOrders" ];
   }

private:
   void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent )
   {
      /* This method is the Format event handler. Whenever the 
              control displays a new value, the value is converted from 
              its native Decimal type to a string. The ToString method 
              then formats the value as a Currency, by using the 
              formatting character "c". */
      // The application can only convert to string type. 
      if ( cevent->DesiredType != String::typeid )
            return;

      cevent->Value = (dynamic_cast<Decimal^>(cevent->Value))->ToString( "c" );
   }

   void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent )
   {
      /* This method is the Parse event handler. The Parse event 
              occurs whenever the displayed value changes. The static 
              ToDecimal method of the Convert class converts the 
              value back to its native Decimal type. */
      // Can only convert to Decimal type.
      if ( cevent->DesiredType != Decimal::typeid )
            return;

      cevent->Value = Decimal::Parse( cevent->Value->ToString(), NumberStyles::Currency, nullptr );
      
      /* To see that no precision is lost, print the unformatted 
              value. For example, changing a value to "10.0001" 
              causes the control to display "10.00", but the 
              unformatted value remains "10.0001". */
      Console::WriteLine( cevent->Value );
   }

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Go to the previous item in the Customer list.
      bmCustomers->Position -= 1;
   }

   void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Go to the next item in the Customer list.
      bmCustomers->Position += 1;
   }

   void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      
      // Go to the previous item in the Orders list.
      bmOrders->Position = bmOrders->Position - 1;
   }

   void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      
      // Go to the next item in the Orders list.
      bmOrders->Position = bmOrders->Position + 1;
   }

private:

   // Create a DataSet with two tables and populate it.
   void MakeDataSet()
   {
      // Create a DataSet.
      ds = gcnew DataSet( "myDataSet" );

      // Create two DataTables.
      DataTable^ tCust = gcnew DataTable( "Customers" );
      DataTable^ tOrders = gcnew DataTable( "Orders" );

      // Create two columns, and add them to the first table.
      DataColumn^ cCustID = gcnew DataColumn( "CustID",Int32::typeid );
      DataColumn^ cCustName = gcnew DataColumn( "CustName" );
      tCust->Columns->Add( cCustID );
      tCust->Columns->Add( cCustName );

      // Create three columns, and add them to the second table.
      DataColumn^ cID = gcnew DataColumn( "CustID",Int32::typeid );
      DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid );
      DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid );
      tOrders->Columns->Add( cOrderAmount );
      tOrders->Columns->Add( cID );
      tOrders->Columns->Add( cOrderDate );

      // Add the tables to the DataSet.
      ds->Tables->Add( tCust );
      ds->Tables->Add( tOrders );

      // Create a DataRelation, and add it to the DataSet.
      DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID );
      ds->Relations->Add( dr );
      
      /* Populate the tables. For each customer and order, 
              create two DataRow variables. */
      DataRow^ newRow1; // = new DataRow();

      DataRow^ newRow2; // = new DataRow();

      // Create three customers in the Customers Table.
      for ( int i = 1; i < 4; i++ )
      {
         newRow1 = tCust->NewRow();
         newRow1[ "custID" ] = i;
         
         // Add the row to the Customers table.
         tCust->Rows->Add( newRow1 );

      }
      tCust->Rows[ 0 ][ "custName" ] = "Alpha";
      tCust->Rows[ 1 ][ "custName" ] = "Beta";
      tCust->Rows[ 2 ][ "custName" ] = "Omega";
      
      // For each customer, create five rows in the Orders table.
      for ( int i = 1; i < 4; i++ )
      {
         for ( int j = 1; j < 6; j++ )
         {
            newRow2 = tOrders->NewRow();
            newRow2[ "CustID" ] = i;
            newRow2[ "orderDate" ] = System::DateTime( 2001, i, j * 2 );
            newRow2[ "OrderAmount" ] = i * 10 + j * .1;
            
            // Add the row to the Orders table.
            tOrders->Rows->Add( newRow2 );
         }
      }
   }
};

int main()
{
   Application::Run( gcnew Form1 );
}
using System;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
   private System.ComponentModel.Container components;
   private Button button1;
   private Button button2;
   private Button button3;
   private Button button4;
   private TextBox text1;
   private TextBox text2;
   private TextBox text3;

   private BindingManagerBase bmCustomers;
   private BindingManagerBase bmOrders;
   private DataSet ds;
   private DateTimePicker DateTimePicker1;

   public Form1()
   {
      // Required for Windows Form Designer support.
      InitializeComponent();
      // Call SetUp to bind the controls.
      SetUp();
   }
 
   private void InitializeComponent()
   {
      // Create the form and its controls.
      this.components = new System.ComponentModel.Container();
      this.button1 = new System.Windows.Forms.Button();
      this.button2 = new System.Windows.Forms.Button();
      this.button3 = new System.Windows.Forms.Button();
      this.button4 = new System.Windows.Forms.Button();
      
      this.text1= new System.Windows.Forms.TextBox();
      this.text2= new System.Windows.Forms.TextBox();
      this.text3= new System.Windows.Forms.TextBox();
      
      this.DateTimePicker1 = new DateTimePicker();
      
      this.Text = "Binding Sample";
      this.ClientSize = new System.Drawing.Size(450, 200);
      
      button1.Location = new System.Drawing.Point(24, 16);
      button1.Size = new System.Drawing.Size(64, 24);
      button1.Text = "<";
      button1.Click+=new System.EventHandler(button1_Click);

      button2.Location = new System.Drawing.Point(90, 16);
      button2.Size = new System.Drawing.Size(64, 24);
      button2.Text = ">";
      button2.Click+=new System.EventHandler(button2_Click);

      button3.Location = new System.Drawing.Point(90, 100);
      button3.Size = new System.Drawing.Size(64, 24);
      button3.Text = "<";
      button3.Click+=new System.EventHandler(button3_Click);

      button4.Location = new System.Drawing.Point(150, 100);
      button4.Size = new System.Drawing.Size(64, 24);
      button4.Text = ">";
      button4.Click+=new System.EventHandler(button4_Click);

      text1.Location = new System.Drawing.Point(24, 50);
      text1.Size = new System.Drawing.Size(150, 24);

      text2.Location = new System.Drawing.Point(190, 50);
      text2.Size = new System.Drawing.Size(150, 24);

      text3.Location = new System.Drawing.Point(290, 150);
      text3.Size = new System.Drawing.Size(150, 24);
      
      DateTimePicker1.Location = new System.Drawing.Point(90, 150);
      DateTimePicker1.Size = new System.Drawing.Size(200, 800);
      
      this.Controls.Add(button1);
      this.Controls.Add(button2);
      this.Controls.Add(button3);
      this.Controls.Add(button4);
      this.Controls.Add(text1);
      this.Controls.Add(text2);
      this.Controls.Add(text3);
      this.Controls.Add(DateTimePicker1);
   }

   protected override void Dispose( bool disposing ){
      if( disposing ){
         if (components != null){
            components.Dispose();}
      }
      base.Dispose( disposing );
   }
   public static void Main()
   {
      Application.Run(new Form1());
   }
   
   private void SetUp()
   {
      // Create a DataSet with two tables and one relation.
      MakeDataSet();
      BindControls();
   }

   protected void BindControls()
   {
      /* Create two Binding objects for the first two TextBox 
         controls. The data-bound property for both controls 
         is the Text property. The data source is a DataSet 
         (ds). The data member is the  
         "TableName.ColumnName" string. */
      text1.DataBindings.Add(new Binding
      ("Text", ds, "customers.custName"));
      text2.DataBindings.Add(new Binding
      ("Text", ds, "customers.custID"));
      
      /* Bind the DateTimePicker control by adding a new Binding. 
         The data member of the DateTimePicker is a 
         TableName.RelationName.ColumnName string. */
      DateTimePicker1.DataBindings.Add(new 
      Binding("Value", ds, "customers.CustToOrders.OrderDate"));

      /* Add event delegates for the Parse and Format events to a 
         new Binding object, and add the object to the third 
         TextBox control's BindingsCollection. The delegates 
         must be added before adding the Binding to the 
         collection; otherwise, no formatting occurs until 
         the Current object of the BindingManagerBase for 
         the data source changes. */
      Binding b = new Binding
         ("Text", ds, "customers.custToOrders.OrderAmount");
      b.Parse+=new ConvertEventHandler(CurrencyStringToDecimal);
      b.Format+=new ConvertEventHandler(DecimalToCurrencyString);
      text3.DataBindings.Add(b);

      // Get the BindingManagerBase for the Customers table. 
      bmCustomers = this.BindingContext [ds, "Customers"];

      /* Get the BindingManagerBase for the Orders table using the 
         RelationName. */ 
      bmOrders = this.BindingContext[ds, "customers.CustToOrders"];
   }

   private void DecimalToCurrencyString(object sender, ConvertEventArgs cevent)
   {
      /* This method is the Format event handler. Whenever the 
         control displays a new value, the value is converted from 
         its native Decimal type to a string. The ToString method 
         then formats the value as a Currency, by using the 
         formatting character "c". */

      // The application can only convert to string type. 
      if(cevent.DesiredType != typeof(string)) return;

      cevent.Value = ((decimal) cevent.Value).ToString("c");
   }

   private void CurrencyStringToDecimal(object sender, ConvertEventArgs cevent)
   {   
      /* This method is the Parse event handler. The Parse event 
         occurs whenever the displayed value changes. The static 
         ToDecimal method of the Convert class converts the 
         value back to its native Decimal type. */

      // Can only convert to decimal type.
      if(cevent.DesiredType != typeof(decimal)) return;

      cevent.Value = Decimal.Parse(cevent.Value.ToString(),
      	NumberStyles.Currency, null);

      /* To see that no precision is lost, print the unformatted 
         value. For example, changing a value to "10.0001" 
         causes the control to display "10.00", but the 
         unformatted value remains "10.0001". */
      Console.WriteLine(cevent.Value);
   }

   private void button1_Click(object sender, System.EventArgs e)
   {
      // Go to the previous item in the Customer list.
      bmCustomers.Position -= 1;
   }

   private void button2_Click(object sender, System.EventArgs e)
   {
      // Go to the next item in the Customer list.
      bmCustomers.Position += 1;
   }
    
   private void button3_Click(object sender, System.EventArgs e)
   {
      // Go to the previous item in the Orders list.
      bmOrders.Position-=1;
   }

   private void button4_Click(object sender, System.EventArgs e)
   {
      // Go to the next item in the Orders list.
      bmOrders.Position+=1;
   }

   // Create a DataSet with two tables and populate it.
   private void MakeDataSet()
   {
      // Create a DataSet.
      ds = new DataSet("myDataSet");
      
      // Create two DataTables.
      DataTable tCust = new DataTable("Customers");
      DataTable tOrders = new DataTable("Orders");

      // Create two columns, and add them to the first table.
      DataColumn cCustID = new DataColumn("CustID", typeof(int));
      DataColumn cCustName = new DataColumn("CustName");
      tCust.Columns.Add(cCustID);
      tCust.Columns.Add(cCustName);

      // Create three columns, and add them to the second table.
      DataColumn cID = 
         new DataColumn("CustID", typeof(int));
      DataColumn cOrderDate = 
         new DataColumn("orderDate",typeof(DateTime));
      DataColumn cOrderAmount = 
         new DataColumn("OrderAmount", typeof(decimal));
      tOrders.Columns.Add(cOrderAmount);
      tOrders.Columns.Add(cID);
      tOrders.Columns.Add(cOrderDate);

      // Add the tables to the DataSet.
      ds.Tables.Add(tCust);
      ds.Tables.Add(tOrders);

      // Create a DataRelation, and add it to the DataSet.
      DataRelation dr = new DataRelation
      ("custToOrders", cCustID , cID);
      ds.Relations.Add(dr);
   
      /* Populate the tables. For each customer and order, 
         create two DataRow variables. */
      DataRow newRow1;
      DataRow newRow2;

      // Create three customers in the Customers Table.
      for(int i = 1; i < 4; i++)
      {
         newRow1 = tCust.NewRow();
         newRow1["custID"] = i;
         // Add the row to the Customers table.
         tCust.Rows.Add(newRow1);
      }
      // Give each customer a distinct name.
      tCust.Rows[0]["custName"] = "Alpha";
      tCust.Rows[1]["custName"] = "Beta";
      tCust.Rows[2]["custName"] = "Omega";
      
      // For each customer, create five rows in the Orders table.
      for(int i = 1; i < 4; i++)
      {
         for(int j = 1; j < 6; j++)
         {
            newRow2 = tOrders.NewRow();
            newRow2["CustID"]= i;
            newRow2["orderDate"]= new DateTime(2001, i, j * 2);
            newRow2["OrderAmount"] = i * 10 + j  * .1;
            // Add the row to the Orders table.
            tOrders.Rows.Add(newRow2);
         }
      }
   }
 }

Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms

Public Class Form1
   Inherits Form

   Private components As Container
   Private button1 As Button
   Private button2 As Button
   Private button3 As Button
   Private button4 As Button
   Private text1 As TextBox
   Private text2 As TextBox
   Private text3 As TextBox

   Private bmCustomers As BindingManagerBase
   Private bmOrders As BindingManagerBase
   Private ds As DataSet
   Private DateTimePicker1 As DateTimePicker
   
   Public Sub New
      ' Required for Windows Form Designer support.
      InitializeComponent
      ' Call SetUp to bind the controls.
      SetUp
   End Sub

   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
         If (components IsNot Nothing) Then
            components.Dispose()
         End If
      End If
      MyBase.Dispose(disposing)
    End Sub


   Private Sub InitializeComponent
      ' Create the form and its controls.
      With Me
         .components = New Container
         .button1 = New Button
         .button2 = New Button
         .button3 = New Button
         .button4 = New Button
         .text1 = New TextBox
         .text2 = New TextBox
         .text3 = New TextBox

         .DateTimePicker1 = New DateTimePicker
         
         .Text = "Binding Sample"
         .ClientSize = New Size(450, 200)

         With .button1
            .Location = New Point(24, 16)
            .Size = New Size(64, 24)
            .Text = "<"
            AddHandler button1.click, AddressOf button1_Click
         End With
         
         
         With .button2
            .Location = New Point(90, 16)
            .Size = New Size(64, 24)
            .Text = ">"
            AddHandler button2.click, AddressOf button2_Click
         End With
         
         With .button3
            .Location = New Point(90, 100)
            .Size = New Size(64, 24)
            .Text = ">"
            AddHandler button3.click, AddressOf button3_Click
         End With

         With .button4
            .Location = New Point(150, 100)
            .Size = New Size(64, 24)
            .Text = ">"
            AddHandler button4.click, AddressOf button4_Click
         End With

         With .text1
            .Location = New Point(24, 50)
            .Size = New Size(150, 24)
         End With

         With .text2
            .Location = New Point(190, 50)
            .Size = New Size(150, 24)
         End With

         With .text3
            .Location = New Point(290, 150)
            .Size = New Size(150, 24)
         End With

            With .DateTimePicker1
               .Location = New Point(90, 150)
               .Size = New Size(200, 800)
            End With

            With .Controls
            .Add(button1)
            .Add(button2)
            .Add(button3)
            .Add(button4)
            .Add(text1)
            .Add(text2)
            .Add(text3)
            .Add(DateTimePicker1)
            End With
      End With
   End Sub
      
   Public Shared Sub Main
      Application.Run(new Form1)
   End Sub

   Private Sub SetUp
      ' Create a DataSet with two tables and one relation.
      MakeDataSet
      BindControls
   End Sub

   Private Sub BindControls
      ' Create two Binding objects for the first two TextBox
      ' controls. The data-bound property for both controls
      ' is the Text property.  The data source is a DataSet
      ' (ds). The data member is the 
      ' TableName.ColumnName" string.

      text1.DataBindings.Add(New _
         Binding("Text", ds, "customers.custName"))
      text2.DataBindings.Add(New _
         Binding("Text", ds, "customers.custID"))
      ' Bind the DateTimePicker control by adding a new Binding.
      ' The data member of the DateTimePicker is a
      ' TableName.RelationName.ColumnName string
      DateTimePicker1.DataBindings.Add(New _
         Binding("Value", ds, "customers.CustToOrders.OrderDate"))
      ' Add event delegates for the Parse and Format events to a
      ' new Binding object, and add the object to the third
      ' TextBox control's BindingsCollection. The delegates
      ' must be added before adding the Binding to the
      ' collection; otherwise, no formatting occurs until
      ' the Current object of the BindingManagerBase for
      ' the data source changes.
      Dim b As Binding = New _
         Binding("Text", ds, "customers.custToOrders.OrderAmount")
      AddHandler b.Parse, AddressOf CurrencyStringToDecimal
      AddHandler b.Format, AddressOf DecimalToCurrencyString
      text3.DataBindings.Add(b)
      
         ' Get the BindingManagerBase for the Customers table.
         bmCustomers = Me.BindingContext(ds, "Customers")

         ' Get the BindingManagerBase for the Orders table using the
         ' RelationName.
         bmOrders = Me.BindingContext(ds, "customers.CustToOrders")
   End Sub

   Private Sub DecimalToCurrencyString(sender As Object, cevent As ConvertEventArgs)
      ' This method is the Format event handler. Whenever the 
      ' control displays a new value, the value is converted from 
      ' its native Decimal type to a string. The ToString method 
      ' then formats the value as a Currency, by using the 
      ' formatting character "c".

      ' The application can only convert to string type. 
   
      If cevent.DesiredType IsNot GetType(String) Then
         Exit Sub
      End If 
   
      cevent.Value = CType(cevent.Value, decimal).ToString("c")
   End Sub

   Private Sub CurrencyStringToDecimal(sender As Object, cevent As ConvertEventArgs)
      ' This method is the Parse event handler. The Parse event 
      ' occurs whenever the displayed value changes. The static 
      ' ToDecimal method of the Convert class converts the 
      ' value back to its native Decimal type.

      ' Can only convert to decimal type.
      If cevent.DesiredType IsNot GetType(decimal) Then
         Exit Sub
      End If

      cevent.Value = Decimal.Parse(cevent.Value.ToString, _
      NumberStyles.Currency, nothing)
      
      ' To see that no precision is lost, print the unformatted 
      ' value. For example, changing a value to "10.0001" 
      ' causes the control to display "10.00", but the 
      ' unformatted value remains "10.0001".
      Console.WriteLine(cevent.Value)
   End Sub

   Private Sub button1_Click(sender As Object, e As System.EventArgs)
      ' Go to the previous item in the Customer list.
      bmCustomers.Position -= 1
   End Sub

   Private Sub button2_Click(sender As Object, e As System.EventArgs)
      ' Go to the next item in the Customer list.
      bmCustomers.Position += 1
   End Sub

   Private Sub button3_Click(sender As Object, e As System.EventArgs)
      ' Go to the previous item in the Order list.
      bmOrders.Position -= 1
   End Sub

   Private Sub button4_Click(sender As Object, e As System.EventArgs)
      ' Go to the next item in the Orders list.
      bmOrders.Position += 1
   End Sub

   ' Creates a DataSet with two tables and populates it.
   Private Sub MakeDataSet
      ' Create a DataSet.
      ds = New DataSet("myDataSet")

      ' Creates two DataTables.
      Dim tCust As DataTable = New DataTable("Customers")
      Dim tOrders As DataTable = New DataTable("Orders")

      ' Create two columns, and add them to the first table.
      Dim cCustID As DataColumn = New DataColumn("CustID", _
      System.Type.GetType("System.Int32"))
      Dim cCustName As DataColumn = New DataColumn("CustName")
      tCust.Columns.Add(cCustID)
      tCust.Columns.Add(cCustName)

      ' Create three columns, and add them to the second table.
      Dim cID As DataColumn = _
         New DataColumn("CustID", System.Type.GetType("System.Int32"))
      Dim cOrderDate As DataColumn = _
         New DataColumn("orderDate", System.Type.GetType("System.DateTime"))
      Dim cOrderAmount As DataColumn = _
         New DataColumn("OrderAmount", System.Type.GetType("System.Decimal"))
      tOrders.Columns.Add(cOrderAmount)
      tOrders.Columns.Add(cID)
      tOrders.Columns.Add(cOrderDate)

      ' Add the tables to the DataSet.
      ds.Tables.Add(tCust)
      ds.Tables.Add(tOrders)

      ' Create a DataRelation, and add it to the DataSet.
      Dim dr As DataRelation = New _
         DataRelation("custToOrders", cCustID, cID)
      ds.Relations.Add(dr)
      
      ' Populate the tables. For each customer and orders,
      ' create two DataRow variables.
      Dim newRow1 As DataRow
      Dim newRow2 As DataRow

         ' Create three customers in the Customers Table.
         Dim i As Integer
         For i = 1 to 3
            newRow1 = tCust.NewRow
            newRow1("custID") = i
            ' Adds the row to the Customers table.
            tCust.Rows.Add(newRow1)
         Next

         ' Give each customer a distinct name.
         tCust.Rows(0)("custName") = "Alpha"
         tCust.Rows(1)("custName") = "Beta"
         tCust.Rows(2)("custName") = "Omega"

         ' For each customer, create five rows in the Orders table.
         Dim j As Integer
         For i = 1 to 3
         For j = 1 to 5
            newRow2 = tOrders.NewRow
            newRow2("CustID") = i
            newRow2("orderDate") = New DateTime(2001, i, j * 2)
            newRow2("OrderAmount") = i * 10 + j * .1
            ' Add the row to the Orders table.
            tOrders.Rows.Add(newRow2)
         Next
         Next
   End Sub
End Class

설명

사용 된 Binding 만들고 단순 바인딩 컨트롤의 속성 및 개체의 속성 또는 개체의 목록에 있는 현재 개체의 속성 사이 유지 관리 하는 클래스입니다.Use the Binding class to create and maintain a simple binding between the property of a control and either the property of an object, or the property of the current object in a list of objects.

첫 번째 경우의 예를 들어, 바인딩할 수 있습니다는 Text 의 속성을 TextBox 컨트롤을 FirstName 의 속성을 Customer 개체.As an example of the first case, you can bind the Text property of a TextBox control to the FirstName property of a Customer object. 두 번째 경우의 예를 들어, 바인딩할 수 있습니다는 Text 의 속성을 TextBox 컨트롤을 FirstName 의 속성을 DataTable 고객을 포함 하는.As an example of the second case, you can bind the Text property of a TextBox control to the FirstName property of a DataTable that contains customers.

Binding 클래스 또한를 통해 표시에 대 한 값의 서식을 지정 수 있습니다 합니다 Format 이벤트를 통해 서식이 지정 된 값을 검색할 수는 Parse 이벤트.The Binding class also enables you to format values for display through the Format event and to retrieve formatted values through the Parse event.

생성할 때를 Binding 인스턴스 Binding 생성자 세 가지 항목을 지정 해야 합니다.When constructing a Binding instance with Binding constructor, you must specify three items:

  • 바인딩할 컨트롤 속성의 이름입니다.The name of the control property to bind to.

  • 데이터 원본입니다.The data source.

  • 목록 또는 데이터 원본에 대 한 속성을 확인 하는 탐색 경로입니다.The navigation path that resolves to a list or property in the data source. 탐색 경로 개체를 만드는 데도 BindingMemberInfo 속성입니다.The navigation path is also used to create the object's BindingMemberInfo property.

먼저 데이터를 바인딩할 컨트롤 속성의 이름을 지정 해야 합니다.First, you must specify name of the control property you want to bind the data to. 예를 들어 데이터를 표시 하려면를 TextBox 컨트롤을 지정 합니다 Text 속성입니다.For example, to display data in a TextBox control, specify the Text property.

둘째, 데이터 원본으로 다음 표에 클래스 중 하나의 인스턴스를 지정할 수 있습니다.Second, you can specify an instance of any one of the classes in the following table as the data source.

설명Description C# 예제C# example
구현 하는 클래스 IBindingList 또는 ITypedList합니다.Any class that implements IBindingList or ITypedList. 여기에 다음: DataSet, DataTableDataView, 또는 DataViewManager합니다.These include the following: DataSet, DataTable, DataView, or DataViewManager. DataSet ds = new DataSet("myDataSet");
구현 하는 클래스 IList 개체의 인덱싱된 컬렉션을 만들려고 합니다.Any class that implements IList to create an indexed collection of objects. 컬렉션을 만들고를 만들기 전에 입력을 Binding입니다.The collection must be created and filled before creating the Binding. 목록의 개체 모두 동일한 형식의; 이어야 합니다. 그렇지 않으면 예외가 throw 됩니다.The objects in the list must all be of the same type; otherwise, an exception will be thrown. ArrayList ar1 = new ArrayList; Customer1 cust1 = new Customer("Louis"); ar1.Add(cust1);
강력한 형식의 IList 강력한 형식의 개체A strongly typed IList of strongly typed objects Customer [] custList = new Customer[3];

셋째, 빈 문자열이 될 수 있는 탐색 경로 지정 해야 합니다 (""), 단일 속성 이름 또는 이름의 마침표로 구분 된 계층 구조입니다.Third, you must specify the navigation path, which can be an empty string (""), a single property name, or a period-delimited hierarchy of names. 탐색 경로 빈 문자열로 설정 하는 경우는 ToString 메서드가 기본 데이터 원본 개체에 대해 호출 됩니다.If you set the navigation path to an empty string, the ToString method will be called on the underlying data source object.

데이터 원본이 있으면를 DataTable를 여러 개 포함할 수 있는 DataColumn 개체에 특정 열을 해결 하려면 탐색 경로 사용 해야 합니다.If the data source is a DataTable, which can contain multiple DataColumn objects, the navigation path must be used to resolve to a specific column.

참고

데이터 원본의 경우는 DataSet, DataViewManager, 또는 DataTable를 바인딩하는 실제로 DataView.When the data source is a DataSet, DataViewManager, or DataTable, you are actually binding to a DataView. 따라서 바인딩된 열은 실제로 DataRowView 개체입니다.Consequently, the bound rows are actually DataRowView objects.

데이터 원본을 여러 개를 포함 하는 개체에 설정 된 경우는 마침표로 구분 된 탐색 경로 필수 DataTable 개체 (예는 DataSet 또는 DataViewManager).A period-delimited navigation path is required when the data source is set to an object that contains multiple DataTable objects (such as a DataSet or DataViewManager). 속성이 다른 개체 (예: 다른 클래스 개체를 반환 하는 속성을 사용 하 여 클래스)에 대 한 참조를 반환 하는 개체에 바인딩하는 경우에 마침표로 구분 된 탐색 경로 사용할 수 있습니다.You can also use a period-delimited navigation path when you bind to an object whose properties return references to other objects (such as a class with properties that return other class objects). 예를 들어, 다음 탐색 경로 모든 유효한 데이터 필드를 설명합니다.For example, the following navigation paths all describe valid data fields:

  • "Size.Height""Size.Height"

  • "Suppliers.CompanyName""Suppliers.CompanyName"

  • "Regions.regionsToCustomers.CustomerFirstName""Regions.regionsToCustomers.CustomerFirstName"

  • "Regions.regionsToCustomers.customersToOrders.ordersToDetails.Quantity""Regions.regionsToCustomers.customersToOrders.ordersToDetails.Quantity"

경로의 각 멤버는 단일 값 (예: 정수)로 확인 되는 속성 또는 값 (예: 문자열의 배열)의 목록을 반환할 수 있습니다.Each member of the path can return either a property that resolves to a single value (such as an integer), or a list of values (such as an array of strings). 경로 있는 각 멤버 속성이 나 목록을 사용할 수 있지만 최종 멤버 속성으로 확인 되어야 합니다.Although each member in the path can be a list or property, the final member must resolve to a property. 각 멤버는 이전 멤버에 기반합니다. "Size.Height"를 확인 합니다 Height 현재 속성 Size; "Regions.regionsToCustomers.CustomerFirstName" 이름을 확인 하는 첫 번째 현재 고객에 대 한 고객은 현재 영역에 대 한 고객 중 하나입니다.Each member builds on the previous member: "Size.Height" resolves to the Height property for the current Size; "Regions.regionsToCustomers.CustomerFirstName" resolves to the first name for the current customer, where the customer is one of the customers for the current region.

A DataRelation 하나에 연결 하 여 값의 목록을 반환 DataTable 를 두 번째 DataTableDataSet합니다.A DataRelation returns a list of values by linking one DataTable to a second DataTable in a DataSet. 경우는 DataSet 포함 DataRelation 개체와 데이터 멤버를 지정할 수 있습니다를 TableName 뒤에 RelationName를 차례로 ColumnName입니다.If the DataSet contains DataRelation objects, you can specify the data member as a TableName followed by a RelationName, and then a ColumnName. 예를 들어 경우는 DataTable "공급 업체" 라는 포함을 DataRelation "suppliers2products" 라는 데이터 멤버 수 "Suppliers.suppliers2products.ProductName"입니다.For example, if the DataTable named "Suppliers" contains a DataRelation named "suppliers2products", the data member could be "Suppliers.suppliers2products.ProductName".

데이터 원본 관련된 클래스 집합을 구성할 수 있습니다.The data source can consist of a set of related classes. 예를 들어, 태양 시스템 카탈로그는 클래스 집합을 가정해 보겠습니다.For example, imagine a set of classes that catalogs solar systems. 이라는 클래스 System 라는 속성이 포함 되어 Stars 의 컬렉션을 반환 하는 Star 개체입니다.The class named System contains a property named Stars that returns a collection of Star objects. Star 개체에 Name 하 고 Mass 속성인 뿐만 Planets 속성의 컬렉션을 반환 하는 Planet 개체.Each Star object has Name and Mass properties, as well as a Planets property that returns a collection of Planet objects. 이 시스템에서 각 행성 역시 MassName 속성입니다.In this system, each planet also has Mass and Name properties. Planet 추가 개체에는 Moons 속성의 컬렉션을 반환 하는 Moon 는 또한 각각의 개체 NameMass 속성입니다.Each Planet object further has a Moons property that returns a collection of Moon objects, each of which also has Name and Mass properties. 지정 하는 경우는 System 개체 데이터 원본으로 데이터 멤버 중 하나를 지정할 수 있습니다.If you specify a System object as the data source, you can specify any of the following as the data member:

  • "Stars.Name""Stars.Name"

  • "Stars.Mass""Stars.Mass"

  • "Stars.Planets.Name""Stars.Planets.Name"

  • "Stars.Planets.Mass""Stars.Planets.Mass"

  • "Stars.Planets.Moons.Name""Stars.Planets.Moons.Name"

  • "Stars.Planets.Moons.Mass""Stars.Planets.Moons.Mass"

단순 바인딩 수 있는 컨트롤 기능 모음인 Binding 개체를 ControlBindingsCollection, 컨트롤을 통해 액세스할 수 있는 DataBindings 속성입니다.Controls that can be simple-bound feature a collection of Binding objects in a ControlBindingsCollection, which you can access through the control's DataBindings property. 추가한를 Binding 를 호출 하 여 컬렉션에는 Add 메서드를 있으므로 컨트롤의 속성에 바인딩 개체의 속성에 (또는 목록에 있는 현재 개체의 속성).You add a Binding to the collection by calling the Add method, thereby binding a property of the control to a property of an object (or to a property of the current object in a list).

바인딩할 수 있습니다 단순에서 파생 되는 모든 개체에는 System.Windows.Forms.Control 예를 들어, 다음과 같은 Windows 컨트롤을 클래스:You can simple-bind to any object that derives from the System.Windows.Forms.Control class, for example, the following Windows controls:

참고

SelectedValue 의 속성을 ComboBox, CheckedListBox, 및 ListBox 컨트롤은 단순 바인딩.Only the SelectedValue property of the ComboBox, CheckedListBox, and ListBox control is simple bound.

합니다 BindingManagerBase 클래스는 모든 관리 하는 추상 클래스는 Binding 특정 데이터 원본 및 데이터 멤버에 대 한 개체입니다.The BindingManagerBase class is an abstract class that manages all the Binding objects for a particular data source and data member. 파생 된 클래스 BindingManagerBase 되는 CurrencyManagerPropertyManager 클래스입니다.Classes that derive from BindingManagerBase are the CurrencyManager and the PropertyManager classes. 어떻게를 Binding 관리 되는 여부에 따라 달라 집니다는 Binding 목록 바인딩 또는 속성 바인딩.How a Binding is managed depends on whether the Binding is a list binding or a property binding. 예를 들어 목록 바인딩을 인 경우 사용할 수는 BindingManagerBase 지정 하는 Position 목록에는 Position, 따라서 목록의 모든 항목) (외부 항목 컨트롤에 실제로 연결을 결정 합니다.For example, if it is a list binding, you can use the BindingManagerBase to specify a Position in the list; the Position, therefore, determines which item (out of all items in the list) is actually bound to a control. 적절 한 반환할 BindingManagerBase를 사용 하 여는 BindingContext합니다.To return the appropriate BindingManagerBase, use the BindingContext.

동일 하 게 바인딩된 컨트롤 집합에 새 행을 추가할 DataSource를 사용 합니다 AddNew 메서드의 BindingManagerBase 클래스.To add a new row to a set of controls bound to the same DataSource, use the AddNew method of the BindingManagerBase class. 사용 하 여는 Item[Object] 의 속성을 BindingContext 적절 한 반환할 클래스 CurrencyManager.Use the Item[Object] property of the BindingContext class to return the appropriate CurrencyManager. 새 행의 추가 이스케이프를 사용 하 여를 CancelCurrentEdit 메서드.To escape the addition of the new row, use the CancelCurrentEdit method.

생성자

Binding(String, Object, String) Binding(String, Object, String) Binding(String, Object, String) Binding(String, Object, String)

새 인스턴스를 초기화 합니다 Binding 표시 된 컨트롤 속성을 데이터 소스의 지정 된 데이터 멤버에 단순 바인딩하는 클래스입니다.Initializes a new instance of the Binding class that simple-binds the indicated control property to the specified data member of the data source.

Binding(String, Object, String, Boolean) Binding(String, Object, String, Boolean) Binding(String, Object, String, Boolean) Binding(String, Object, String, Boolean)

새 인스턴스를 초기화 합니다 Binding 표시 된 컨트롤 속성 데이터 소스의 지정 된 데이터 멤버에 바인딩하고 선택적으로 적용할 서식 지정을 활성화 하는 클래스입니다.Initializes a new instance of the Binding class that binds the indicated control property to the specified data member of the data source, and optionally enables formatting to be applied.

Binding(String, Object, String, Boolean, DataSourceUpdateMode) Binding(String, Object, String, Boolean, DataSourceUpdateMode) Binding(String, Object, String, Boolean, DataSourceUpdateMode) Binding(String, Object, String, Boolean, DataSourceUpdateMode)

새 인스턴스를 초기화 합니다 Binding 지정된 된 컨트롤 속성을 지정 된 데이터 소스의 지정 된 데이터 멤버로 바인딩하는 클래스입니다.Initializes a new instance of the Binding class that binds the specified control property to the specified data member of the specified data source. 선택적으로 서식 지정을 활성화하고 지정된 업데이트 설정을 기반으로 데이터 소스에 값을 전파합니다.Optionally enables formatting and propagates values to the data source based on the specified update setting.

Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object)

새 인스턴스를 초기화 합니다 Binding 표시 된 컨트롤 속성에 지정 된 데이터 소스의 지정 된 데이터 멤버에 바인딩하는 클래스입니다.Initializes a new instance of the Binding class that binds the indicated control property to the specified data member of the specified data source. 선택적으로 서식 지정을 활성화, 지정 된 업데이트 설정을 기반으로 데이터 원본에 값을 전파 및 지정 된 속성을 설정 값을 DBNull 데이터 원본에서 반환 됩니다.Optionally enables formatting, propagates values to the data source based on the specified update setting, and sets the property to the specified value when a DBNull is returned from the data source.

Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String)

새 인스턴스를 초기화 합니다 Binding 지정된 된 컨트롤 속성을 지정 된 데이터 소스의 지정 된 데이터 멤버로 바인딩하는 클래스입니다.Initializes a new instance of the Binding class that binds the specified control property to the specified data member of the specified data source. 필요에 따라 지정 된 형식 문자열을 사용 하 여 서식 지정을 활성화합니다 지정 된 업데이트 설정에 따라 데이터 원본에 값을 전파 지정 된 속성을 설정 하 고 값을 DBNull 데이터 원본에서 반환 됩니다.Optionally enables formatting with the specified format string; propagates values to the data source based on the specified update setting; and sets the property to the specified value when a DBNull is returned from the data source.

Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider) Binding(String, Object, String, Boolean, DataSourceUpdateMode, Object, String, IFormatProvider)

새 인스턴스를 초기화 합니다 Binding 지정 된 데이터 소스의 지정 된 데이터 멤버에 지정 된 컨트롤 속성을 사용 하 여 클래스입니다.Initializes a new instance of the Binding class with the specified control property to the specified data member of the specified data source. 필요에 따라 지정 된 형식 문자열을 사용 하 여 서식 지정을 활성화합니다 지정 된 업데이트 설정에 따라 데이터 원본에 값을 전파 지정 된 형식 문자열을 사용 하 여 서식 지정을 사용 하도록 설정 지정 된 속성을 설정 값을 DBNull 데이터 소스에서 반환 되 고 지정된 된 형식 공급자를 설정 합니다.Optionally enables formatting with the specified format string; propagates values to the data source based on the specified update setting; enables formatting with the specified format string; sets the property to the specified value when a DBNull is returned from the data source; and sets the specified format provider.

속성

BindableComponent BindableComponent BindableComponent BindableComponent

컨트롤을 가져옵니다는 Binding 연관 됩니다.Gets the control the Binding is associated with.

BindingManagerBase BindingManagerBase BindingManagerBase BindingManagerBase

BindingManagerBaseBinding를 가져옵니다.Gets the BindingManagerBase for this Binding.

BindingMemberInfo BindingMemberInfo BindingMemberInfo BindingMemberInfo

기반으로이 바인딩에 대 한 정보가 들어 있는 개체를 가져옵니다 합니다 dataMember 의 매개 변수는 Binding 생성자입니다.Gets an object that contains information about this binding based on the dataMember parameter in the Binding constructor.

Control Control Control Control

바인딩이 속한 컨트롤을 가져옵니다.Gets the control that the binding belongs to.

ControlUpdateMode ControlUpdateMode ControlUpdateMode ControlUpdateMode

데이터 소스의 변경 사항이 바인딩된 컨트롤 속성에 전파되는 시기를 가져오거나 설정합니다.Gets or sets when changes to the data source are propagated to the bound control property.

DataSource DataSource DataSource DataSource

이 바인딩에 대한 데이터 소스를 가져옵니다.Gets the data source for this binding.

DataSourceNullValue DataSourceNullValue DataSourceNullValue DataSourceNullValue

컨트롤 값이 데이터 원본에 저장 될 값을 가져오거나 설정 합니다. null 이거나 비어 있습니다.Gets or sets the value to be stored in the data source if the control value is null or empty.

DataSourceUpdateMode DataSourceUpdateMode DataSourceUpdateMode DataSourceUpdateMode

바인딩된 컨트롤 속성의 변경 사항이 데이터 소스에 전파되는 시기를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates when changes to the bound control property are propagated to the data source.

FormatInfo FormatInfo FormatInfo FormatInfo

가져오거나 설정 합니다 IFormatProvider 사용자 지정 서식 지정 동작을 제공 하는 합니다.Gets or sets the IFormatProvider that provides custom formatting behavior.

FormatString FormatString FormatString FormatString

값을 표시할 방법을 나타내는 서식 지정자 문자를 가져오거나 설정합니다.Gets or sets the format specifier characters that indicate how a value is to be displayed.

FormattingEnabled FormattingEnabled FormattingEnabled FormattingEnabled

컨트롤 속성 데이터에 형식 변환과 서식 지정이 적용되는지를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether type conversion and formatting is applied to the control property data.

IsBinding IsBinding IsBinding IsBinding

바인딩이 활성화되어 있는지를 나타내는 값을 가져옵니다.Gets a value indicating whether the binding is active.

NullValue NullValue NullValue NullValue

가져오거나 설정 합니다 Object 데이터 원본에 포함 된 컨트롤 속성으로 설정 하는 DBNull 값.Gets or sets the Object to be set as the control property when the data source contains a DBNull value.

PropertyName PropertyName PropertyName PropertyName

컨트롤의 데이터 바인딩된 속성의 이름을 가져옵니다.Gets the name of the control's data-bound property.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
OnBindingComplete(BindingCompleteEventArgs) OnBindingComplete(BindingCompleteEventArgs) OnBindingComplete(BindingCompleteEventArgs) OnBindingComplete(BindingCompleteEventArgs)

BindingComplete 이벤트를 발생시킵니다.Raises the BindingComplete event.

OnFormat(ConvertEventArgs) OnFormat(ConvertEventArgs) OnFormat(ConvertEventArgs) OnFormat(ConvertEventArgs)

Format 이벤트를 발생시킵니다.Raises the Format event.

OnParse(ConvertEventArgs) OnParse(ConvertEventArgs) OnParse(ConvertEventArgs) OnParse(ConvertEventArgs)

Parse 이벤트를 발생시킵니다.Raises the Parse event.

ReadValue() ReadValue() ReadValue() ReadValue()

컨트롤 속성을 데이터 소스에서 읽은 값으로 설정합니다.Sets the control property to the value read from the data source.

ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)
WriteValue() WriteValue() WriteValue() WriteValue()

컨트롤 속성에서 현재 값을 읽고 데이터 소스에 씁니다.Reads the current value from the control property and writes it to the data source.

이벤트

BindingComplete BindingComplete BindingComplete BindingComplete

발생 경우 합니다 FormattingEnabled 속성이 true 바인딩 작업이 완료 되 면 데이터 원본에 또는 그 반대로 컨트롤에서 데이터를 밀어넣을 하는 경우 같은 및Occurs when the FormattingEnabled property is set to true and a binding operation is complete, such as when data is pushed from the control to the data source or vice versa

Format Format Format Format

컨트롤의 속성이 데이터 값에 바인딩되면 발생합니다.Occurs when the property of a control is bound to a data value.

Parse Parse Parse Parse

데이터 바인딩된 컨트롤의 값이 변경되면 발생합니다.Occurs when the value of a data-bound control changes.

적용 대상

추가 정보