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.
Ruft die Anzahl der Elemente in der Liste ab.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Overrides ReadOnly Property Count As Integer
'Usage
Dim instance As CurrencyManager
Dim value As Integer
value = instance.Count
public override int Count { get; }
public:
virtual property int Count {
int get () override;
}
/** @property */
public int get_Count ()
public override function get Count () : int
Eigenschaftenwert
Die Anzahl der Elemente in der Liste.
Hinweise
Mit der count-Eigenschaft kann bestimmt werden, wann das Ende einer Liste erreicht ist. Da CurrencyManager ein nullbasiertes Array von Elementen beibehält, ist das Ende der Liste immer Count minus 1.
Beispiel
Im folgenden Codebeispiel wird die Liste durchlaufen, bis das durch die Count-Eigenschaft bestimmte letzte Element erreicht ist.
Private Sub PrintListItems()
' Get the CurrencyManager of a TextBox control.
Dim myCurrencyManager As CurrencyManager = CType(textBox1.BindingContext(0), CurrencyManager)
' Presuming the list is a DataView, create a DataRowView variable.
Dim drv As DataRowView
Dim i As Integer
For i = 0 To myCurrencyManager.Count - 1
myCurrencyManager.Position = i
drv = CType(myCurrencyManager.Current, DataRowView)
' Presuming a column named CompanyName exists.
Console.WriteLine(drv("CompanyName"))
Next i
End Sub 'PrintListItems
private void PrintListItems() {
// Get the CurrencyManager of a TextBox control.
CurrencyManager myCurrencyManager = (CurrencyManager)textBox1.BindingContext[0];
// Presuming the list is a DataView, create a DataRowView variable.
DataRowView drv;
for(int i = 0; i < myCurrencyManager.Count; i++) {
myCurrencyManager.Position = i;
drv = (DataRowView)myCurrencyManager.Current;
// Presuming a column named CompanyName exists.
Console.WriteLine(drv["CompanyName"]);
}
}
void PrintListItems()
{
// Get the CurrencyManager of a TextBox control.
CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(textBox1->BindingContext[nullptr]);
// Presuming the list is a DataView, create a DataRowView variable.
DataRowView^ drv;
for ( int i = 0; i < myCurrencyManager->Count; i++ )
{
myCurrencyManager->Position = i;
drv = dynamic_cast<DataRowView^>(myCurrencyManager->Current);
// Presuming a column named CompanyName exists.
Console::WriteLine( drv[ "CompanyName" ] );
}
}
private void PrintListItems()
{
// Get the CurrencyManager of a TextBox control.
CurrencyManager myCurrencyManager = ((CurrencyManager)(
textBox1.get_BindingContext().get_Item((System.Int32)(0))));
// Presuming the list is a DataView, create a DataRowView variable.
DataRowView drv;
for (int i = 0; i < myCurrencyManager.get_Count(); i++) {
myCurrencyManager.set_Position(i);
drv = (DataRowView)(myCurrencyManager.get_Current());
// Presuming a column named CompanyName exists.
Console.WriteLine(drv.get_Item("CompanyName"));
}
} //PrintListItems
private function PrintListItems() {
// Get the CurrencyManager of a TextBox control.
var myCurrencyManager : CurrencyManager = CurrencyManager(textBox1.BindingContext[0]);
// Presuming the list is a DataView, create a DataRowView variable.
var drv : DataRowView;
for(var i : int = 0; i < myCurrencyManager.Count; i++) {
myCurrencyManager.Position = i;
drv = DataRowView(myCurrencyManager.Current);
// Presuming a column named CompanyName exists.
Console.WriteLine(drv["CompanyName"]);
}
}
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
Position
Current