This documentation is archived and is not being maintained.

Control.BindingContextChanged Event

Occurs when the value of the BindingContext property changes.

[Visual Basic]
Public Event BindingContextChanged As EventHandler
[C#]
public event EventHandler BindingContextChanged;
[C++]
public: __event EventHandler* BindingContextChanged;

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

Event Data

The event handler receives an argument of type EventArgs.

Remarks

To add a new BindingContext to the Control through the BindingContext property, see the BindingContext constructor.

This event is raised if the BindingContext property is changed is changed by either a programmatic modification or user interaction.

For more information about handling events, see Consuming Events.

Example

The following example adds an EventHandler delegate to the BindingContextChanged event of a TextBox control.

[Visual Basic] 
Private Sub AddEventHandler()
    AddHandler textBox1.BindingContextChanged, _
       AddressOf BindingContext_Changed
End Sub    
   
Private Sub BindingContext_Changed(sender As Object, e As EventArgs)
    Console.WriteLine("BindingContext changed")
End Sub

[C#] 
private void AddEventHandler()
{
   textBox1.BindingContextChanged += new EventHandler(BindingContext_Changed);
}

private void BindingContext_Changed(object sender, EventArgs e)
{
   Console.WriteLine("BindingContext changed");
}

[C++] 
private:
void AddEventHandler()
{
   textBox1->BindingContextChanged += new EventHandler(this, &Form1::BindingContext_Changed);
}

void BindingContext_Changed(Object* /*sender*/, EventArgs* /*e*/)
{
   Console::WriteLine(S"BindingContext changed");
}

[JScript] 
private function AddEventHandler()
{
   textBox1.add_BindingContextChanged(BindingContext_Changed);
}

private function BindingContext_Changed(sender : Object, e : EventArgs)
{
   Console.WriteLine("BindingContext changed");
}

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | BindingContext | Binding | BindingManagerBase | OnBindingContextChanged

Show: