BindingManagerBase::PositionChanged Event
.NET Framework (current version)
Occurs after the value of the Position property has changed.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
For more information about handling events, see Handling and Raising Events.
The following code example creates a Binding, and then adds it to a collection of Binding objects for a TextBox control. The example then gets the BindingManagerBase for the data source and adds a delegate to the PositionChanged event.
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 ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: