BindingManagerBase::CurrentChanged Event
.NET Framework (current version)
Occurs when the currently bound item changes.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The CurrentChanged event is raised whenever the Current property changes or the CurrentItemChanged event occurs.
For more information about handling events, see Handling and Raising Events.
The following code example prints the value of the Current object in a BindingManagerBase in the CurrentChanged event. The example assumes the data source is a DataTable containing a DataColumn named CustName.
void Current_Changed( Object^ sender, EventArgs^ /*e*/ ) { BindingManagerBase^ bm = dynamic_cast<BindingManagerBase^>(sender); /* Check the type of the Current object. If it is not a DataRowView, exit the method. */ if ( bm->Current->GetType() != DataRowView::typeid ) return; // Otherwise, print the value of the column named "CustName". DataRowView^ drv = dynamic_cast<DataRowView^>(bm->Current); Console::Write( "CurrentChanged): " ); Console::Write( drv[ "CustName" ] ); Console::WriteLine(); }
.NET Framework
Available since 1.1
Available since 1.1
Show: