ValidatorCollection.CopyTo-Methode
Kopiert die Validierungssteuerelementauflistung in das angegebene Array, wobei an der angegebenen Position begonnen wird.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Syntax
'Declaration
Public Sub CopyTo ( _
array As Array, _
index As Integer _
)
'Usage
Dim instance As ValidatorCollection
Dim array As Array
Dim index As Integer
instance.CopyTo(array, index)
public void CopyTo (
Array array,
int index
)
public:
virtual void CopyTo (
Array^ array,
int index
) sealed
public final void CopyTo (
Array array,
int index
)
public final function CopyTo (
array : Array,
index : int
)
Parameter
- array
Die Auflistung, der das Serversteuerelement für die Validierung hinzugefügt wird.
- index
Der Index, an dessen Position das angegebene Serversteuerelement für die Validierung kopiert wird.
Beispiel
Im folgenden Codebeispiel wird die Verwendung der CopyTo-Methode veranschaulicht.
' Get 'Validators' of the page to myCollection.
Dim myCollection As ValidatorCollection = Page.Validators
Dim myObjArray() As Object = New Object(4){0, 0, 0, 0, 0}
' Copy the 'Collection' to 'Array'.
myCollection.CopyTo(myObjArray, 0)
' Print the values in the Array.
Dim myStr As String = " "
Dim i As Integer
For i = 0 To myCollection.Count - 1
myStr += myObjArray(i).ToString()
myStr += " "
Next i
msgLabel.Text = myStr
// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = Page.Validators ;
// Object Array.
Object[] myObjArray = new Object[5] { 0, 0, 0, 0, 0 };
// Copy the 'Collection' to 'Array'.
myCollection.CopyTo(myObjArray,0);
// Print the values in the Array.
string myStr = " ";
for(int i = 0; i<myCollection.Count; i++)
{
myStr += myObjArray[i].ToString();
myStr += " ";
}
msgLabel.Text = myStr;
// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = get_Validators();
// Object Array.
Object myObjArray[] = new Object[] { (Int32)0, (Int32)0, (Int32)0,
(Int32)0, (Int32)0 };
// Copy the 'Collection' to 'Array'.
myCollection.CopyTo(myObjArray,0);
// Print the values in the Array.
String myStr = " ";
for(int i = 0; i<myCollection.get_Count(); i++) {
myStr += System.Convert.ToString(myObjArray.get_Item(i));
myStr += " ";
}
msgLabel.set_Text(myStr);
Plattformen
Windows 98, Windows 2000 SP4, 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
Siehe auch
Referenz
ValidatorCollection-Klasse
ValidatorCollection-Member
System.Web.UI-Namespace