asp.net.ph

DataControlFieldCollection.CopyTo Method

System.Web.UI.WebControls Namespace   DataControlFieldCollection Class


.NET Framework version 2.0

Copies the contents of the collection into an Array, starting at the specified index of the Array object.

[ VB ]
NotOverridable Public Sub CopyTo ( _
   ByVal array As Array, _
   ByVal index As Integer _
)

[ C# ]
public void CopyTo (
   Array array,
   int index
);

[ C++ ]
public: __sealed void CopyTo (
   Array* array,
   int index
);

[ JScript ]
public function CopyTo (
   array : Array,
   index : int
);

Parameters

array
A System.Array object to copy the contents of the collection into.
index
The zero-based index of the Array to begin copying the contents of the collection into.

Remarks

Use this method to copy the contents of the DataControlFieldCollection into the specified System.Array object, starting at the specified index.

NOTE: The array parameter must be a zero-based System.Array object.

Example

The following example demonstrates how to use the CopyTo method to copy the contents of the DataControlFieldCollection to an array of DataControlField objects.

void copyTo ( Object src, EventArgs e ) {
   DataControlField [ ] myArray = new DataControlField [ 3 ];
   myGrid.Columns.CopyTo ( myArray, 0 );
   myLabel.Text = "The heading text for the items in the array are: <p>";

   foreach ( DataControlField column in myArray ) {
      myLabel.Text += column.HeaderText + "<br>";
   }
}
  C# VB

See Also

DataControlFieldCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph