Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Erzwingt ein erneutes Auffüllen der datengebundenen Liste.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Sub Refresh
'Usage
Dim instance As CurrencyManager
instance.Refresh
public void Refresh ()
public:
void Refresh ()
public void Refresh ()
public function Refresh ()
Hinweise
Verwenden Sie die Refresh-Methode, wenn die Datenquelle keine Benachrichtigung bei Änderungen unterstützt (z. B., wenn sie ein Array ist).
Beispiel
Im folgenden Codebeispiel wird ein Array erstellt, das an ein TextBox-Steuerelement gebunden wird. Anschließend wird ein Wert geändert. Die Refresh-Methode kann aufgerufen werden, um den vom TextBox-Steuerelement angezeigten Wert zu aktualisieren.
Private Sub DemonstrateRefresh()
' Create an array with ten elements and bind to a TextBox.
Dim myArray(9) As String
Dim i As Integer
For i = 0 To 9
myArray(i) = "item " & i
Next i
textBox1.DataBindings.Add("Text", myArray, "")
' Change one value.
myArray(0) = "New value"
' Uncomment the next line to refresh the CurrencyManager.
' RefreshGrid(myArray);
End Sub 'DemonstrateRefresh
Private Sub RefreshGrid(dataSource As Object)
Dim myCurrencyManager As CurrencyManager = CType(Me.BindingContext(dataSource), CurrencyManager)
myCurrencyManager.Refresh()
End Sub 'RefreshGrid
private void DemonstrateRefresh(){
// Create an array with ten elements and bind to a TextBox.
string[] myArray= new string[10];
for(int i = 0; i <10; i++){
myArray[i] = "item " + i;
}
textBox1.DataBindings.Add ("Text",myArray,"");
// Change one value.
myArray[0]= "New value";
// Uncomment the next line to refresh the CurrencyManager.
// RefreshGrid(myArray);
}
private void RefreshGrid(object dataSource){
CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[dataSource];
myCurrencyManager.Refresh();
}
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();
}
private void DemonstrateRefresh()
{
// Create an array with ten elements and bind to a TextBox.
String myArray[] = new String[10];
for (int i = 0; i < 10; i++) {
myArray[i] = "item " + i;
}
textBox1.get_DataBindings().Add("Text", myArray, "");
// Change one value.
myArray[0] = "New value";
} //DemonstrateRefresh
// Uncomment the next line to refresh the CurrencyManager.
// RefreshGrid(myArray);
private void RefreshGrid(Object dataSource)
{
CurrencyManager myCurrencyManager =
(CurrencyManager)(this.get_BindingContext().
get_Item(dataSource));
myCurrencyManager.Refresh();
} //RefreshGrid
private function DemonstrateRefresh(){
// Create an array with ten elements and bind to a TextBox.
var myArray : String[] = new String[10];
for(var i : int = 0; i <10; i++){
myArray[i] = "item " + i;
}
textBox1.DataBindings.Add ("Text",myArray,"");
// Change one value.
myArray[0]= "New value";
// Uncomment the next line to refresh the CurrencyManager.
// RefreshGrid(myArray);
}
private function RefreshGrid(dataSource){
var myCurrencyManager : CurrencyManager = CurrencyManager(this.BindingContext[dataSource]);
myCurrencyManager.Refresh();
}
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
CurrencyManager-Klasse
CurrencyManager-Member
System.Windows.Forms-Namespace
List