BindingManagerBase.PositionChanged 이벤트
Position 속성 값이 변경된 후 발생합니다.
네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)
구문
‘선언
Public Event PositionChanged As EventHandler
‘사용 방법
Dim instance As BindingManagerBase
Dim handler As EventHandler
AddHandler instance.PositionChanged, handler
public event EventHandler PositionChanged
public:
event EventHandler^ PositionChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
/** @event */
public void add_PositionChanged (EventHandler value)
/** @event */
public void remove_PositionChanged (EventHandler value)
JScript에서는 이벤트를 사용할 수 있지만 새로 선언할 수는 없습니다.
설명
이벤트 처리에 대한 자세한 내용은 이벤트 사용을 참조하십시오.
예제
다음 코드 예제에서는 Binding을 만든 다음 TextBox 컨트롤에 대한 Binding 개체의 컬렉션에 추가합니다. 그런 다음 예제에서는 데이터 소스에 대한 BindingManagerBase를 가져오고 대리자를 PositionChanged 이벤트에 추가합니다.
Protected Sub BindControl()
' Create a Binding object for the TextBox control.
' The data-bound property for the control is the Text
' property.
Dim myBinding As New Binding("Text", ds, "customers.custName")
text1.DataBindings.Add(myBinding)
' Get the BindingManagerBase for the Customers table.
Dim bmCustomers As BindingManagerBase = Me.BindingContext(ds, "Customers")
' Add the delegate for the PositionChanged event.
AddHandler bmCustomers.PositionChanged, AddressOf Position_Changed
End Sub 'BindControl
Private Sub Position_Changed(sender As Object, e As EventArgs)
' Print the Position property value when it changes.
Console.WriteLine(CType(sender, BindingManagerBase).Position)
End Sub 'Position_Changed
protected void BindControl()
{
/* Create a Binding object for the TextBox control.
The data-bound property for the control is the Text
property. */
Binding myBinding =
new Binding("Text", ds, "customers.custName");
text1.DataBindings.Add(myBinding);
// Get the BindingManagerBase for the Customers table.
BindingManagerBase bmCustomers =
this.BindingContext [ds, "Customers"];
// Add the delegate for the PositionChanged event.
bmCustomers.PositionChanged +=
new EventHandler(Position_Changed);
}
private void Position_Changed(object sender, EventArgs e)
{
// Print the Position property value when it changes.
Console.WriteLine(((BindingManagerBase)sender).Position);
}
void BindControl()
{
/* Create a Binding object for the TextBox control.
The data-bound property for the control is the Text
property. */
Binding^ myBinding = gcnew Binding( "Text",ds,"customers.custName" );
text1->DataBindings->Add( myBinding );
// Get the BindingManagerBase for the Customers table.
BindingManagerBase^ bmCustomers = this->BindingContext[ ds,"Customers" ];
// Add the delegate for the PositionChanged event.
bmCustomers->PositionChanged += gcnew EventHandler( this, &Form1::Position_Changed );
}
private:
void Position_Changed( Object^ sender, EventArgs^ /*e*/ )
{
// Print the Position property value when it changes.
Console::WriteLine( (dynamic_cast<BindingManagerBase^>(sender))->Position );
}
protected void BindControl()
{
/* Create a Binding object for the TextBox control.
The data-bound property for the control is the Text
property.
*/
Binding myBinding = new Binding("Text", ds, "customers.custName");
text1.get_DataBindings().Add(myBinding);
// Get the BindingManagerBase for the Customers table.
BindingManagerBase bmCustomers =
this.get_BindingContext().get_Item(ds, "Customers");
// Add the delegate for the PositionChanged event.
bmCustomers.add_PositionChanged(new EventHandler(Position_Changed));
} //BindControl
private void Position_Changed(Object sender, EventArgs e)
{
// Print the Position property value when it changes.
Console.WriteLine(((BindingManagerBase)(sender)).get_Position());
} //Position_Changed
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0, 1.0에서 지원
참고 항목
참조
BindingManagerBase 클래스
BindingManagerBase 멤버
System.Windows.Forms 네임스페이스