CurrencyManager::Refresh Method ()
.NET Framework (current version)
Forces a repopulation of the data-bound list.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Use the Refresh method when the data source does not support notification when it is changed (for example, if it is an Array).
The following code example creates an array and binds it to a TextBox control, and then changes one value. The Refresh method can be called to update the value displayed by the TextBox control.
void DemonstrateRefresh() { // Create an array with ten elements and bind to a TextBox. array<String^>^myArray = gcnew array<String^>(10); for ( int i = 0; i < 10; i++ ) { myArray[ i ] = String::Format( "item {0}", i ); } textBox1->DataBindings->Add( "Text", myArray, "" ); // Change one value. myArray[ 0 ] = "New value"; // Uncomment the next line to refresh the CurrencyManager. // RefreshGrid(myArray); } void RefreshGrid( Object^ dataSource ) { CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(this->BindingContext[ dataSource ]); myCurrencyManager->Refresh(); }
.NET Framework
Available since 1.1
Available since 1.1
Show: