CurrencyManager.ItemChanged CurrencyManager.ItemChanged CurrencyManager.ItemChanged CurrencyManager.ItemChanged Event

정의

현재 항목이 변경되면 발생합니다.Occurs when the current item has been altered.

public:
 event System::Windows::Forms::ItemChangedEventHandler ^ ItemChanged;
public event System.Windows.Forms.ItemChangedEventHandler ItemChanged;
member this.ItemChanged : System.Windows.Forms.ItemChangedEventHandler 
Public Custom Event ItemChanged As ItemChangedEventHandler 

예제

다음 코드 예제에 대 한 이벤트 처리기를 추가 합니다 ItemChangedPositionChanged 이벤트입니다.The following code example adds event handlers for the ItemChanged and PositionChanged events.

void BindControl( DataTable^ myTable )
{
   
   // Bind A TextBox control to a DataTable column in a DataSet.
   textBox1->DataBindings->Add( "Text", myTable, "CompanyName" );
   
   // Specify the CurrencyManager for the DataTable.
   myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[myTable, ""]);
   
   // Add event handlers.
   myCurrencyManager->ItemChanged += gcnew ItemChangedEventHandler( this, &Form1::CurrencyManager_ItemChanged );
   myCurrencyManager->PositionChanged += gcnew EventHandler( this, &Form1::CurrencyManager_PositionChanged );
   
   // Set the initial Position of the control.
   myCurrencyManager->Position = 0;
}

void CurrencyManager_PositionChanged( Object^ sender, System::EventArgs^ /*e*/ )
{
   CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(sender);
   Console::WriteLine( "Position Changed {0}", myCurrencyManager->Position );
}

void CurrencyManager_ItemChanged( Object^ sender, System::Windows::Forms::ItemChangedEventArgs^ /*e*/ )
{
   CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(sender);
   Console::WriteLine( "Item Changed {0}", myCurrencyManager->Position );
}

private void BindControl(DataTable myTable)
{
    // Bind A TextBox control to a DataTable column in a DataSet.
    textBox1.DataBindings.Add("Text", myTable, "CompanyName");
    // Specify the CurrencyManager for the DataTable.
    myCurrencyManager = (CurrencyManager)this.BindingContext[myTable, ""];
    // Add event handlers.
    myCurrencyManager.ItemChanged+=
    new ItemChangedEventHandler(CurrencyManager_ItemChanged);
    myCurrencyManager.PositionChanged+= 
    new EventHandler(CurrencyManager_PositionChanged);
    // Set the initial Position of the control.
    myCurrencyManager.Position = 0;
}

private void CurrencyManager_PositionChanged(object sender, System.EventArgs e){
    CurrencyManager myCurrencyManager = (CurrencyManager) sender;
    Console.WriteLine("Position Changed " + myCurrencyManager.Position);
}

private void CurrencyManager_ItemChanged(object sender, System.Windows.Forms.ItemChangedEventArgs e){
    CurrencyManager myCurrencyManager = (CurrencyManager) sender;
    Console.WriteLine("Item Changed " + myCurrencyManager.Position);
}
Private Sub BindControl(myTable As DataTable)
    ' Bind A TextBox control to a DataTable column in a DataSet.
    textBox1.DataBindings.Add("Text", myTable, "CompanyName")
    ' Specify the CurrencyManager for the DataTable.
    myCurrencyManager = CType(Me.BindingContext(myTable, ""), CurrencyManager)
    ' Add event handlers.
    AddHandler myCurrencyManager.ItemChanged, AddressOf CurrencyManager_ItemChanged
    AddHandler myCurrencyManager.PositionChanged, AddressOf CurrencyManager_PositionChanged
    ' Set the initial Position of the control.
    myCurrencyManager.Position = 0
End Sub 'BindControl


Private Sub CurrencyManager_PositionChanged(sender As Object, e As System.EventArgs)
    Dim myCurrencyManager As CurrencyManager = CType(sender, CurrencyManager)
    Console.WriteLine(("Position Changed " & myCurrencyManager.Position))
End Sub 'CurrencyManager_PositionChanged


Private Sub CurrencyManager_ItemChanged(sender As Object, e As System.Windows.Forms.ItemChangedEventArgs)
    Dim myCurrencyManager As CurrencyManager = CType(sender, CurrencyManager)
    Console.WriteLine(("Item Changed " & myCurrencyManager.Position))
End Sub 'CurrencyManager_ItemChanged

설명

합니다 ItemChanged 호출할 때 이벤트가 발생 하는 합니다 ResumeBinding 또는 SuspendBinding 메서드.The ItemChanged event will occur when the user calls the ResumeBinding or SuspendBinding method.

ItemChanged 만 항목 자체가 변경 된 경우 몇 가지 방식으로 이벤트가 발생 합니다.The ItemChanged event occurs only when the item itself has been changed in some manner. 예를 들어 10에서 42 항목의 값을 변경 하는 경우 이벤트가 발생 합니다.For example, if the value of an item is changed from 10 to 42, the event will occur. 이 혼동 하지는 PositionChanged 새 항목에는 항목이 변경 되었지만 여기서는 이벤트입니다.This should not be confused with the PositionChanged event where the item has been changed to a new item.

기본 데이터가 변경 된 경우에 이벤트가 발생 합니다.The event will also occur if the underlying data changes. 예를 들어의 값을 변경 하는 경우는 DataRowView, ItemChanged 이벤트가 발생 합니다.For example, if you change the value of a DataRowView, the ItemChanged event will occur.

참고

사용 하는 고유한 컨트롤을 만들려는 경우는 CurrencyManager를 사용 해야 합니다 IBindingList.ListChanged 대신는 CurrencyManager.ItemChanged 이벤트.If you are creating your own control that uses the CurrencyManager, you should use the IBindingList.ListChanged instead of the CurrencyManager.ItemChanged event. 합니다 ListChangedType 의 속성을 ListChangedEventArgs 발생 하는 작업의 형식을 확인할 수 있습니다.The ListChangedType property of the ListChangedEventArgs enables you to determine the type of action that has occurred.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.For more information about handling events, see Handling and Raising Events.

적용 대상

추가 정보