PositionChanged Event
Collapse the table of content
Expand the table of content

BindingManagerBase.PositionChanged Event

 

Occurs after the value of the Position property has changed.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event EventHandler PositionChanged

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.

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);
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft