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
/** @event */
public void add_PositionChanged (EventHandler value)

/** @event */
public void remove_PositionChanged (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

For more information about handling events, see Consuming 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);
}


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 Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show: