Spread Windows Forms 12.0 Product Documentation
CopyTo(Array,Int32) Method
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyleCollection Class > CopyTo Method : CopyTo(Array,Int32) Method
One-dimensional array into which are copied the elements from ICollection (The array must have zero-based indexing.)
Zero-based index in array at which to paste styles
Copies the styles in the collection to a specified array at a specified position.
Syntax
'Declaration
 
Public Overloads Overridable Sub CopyTo( _
   ByVal array As Array, _
   ByVal index As Integer _
) 
'Usage
 
Dim instance As NamedStyleCollection
Dim array As Array
Dim index As Integer
 
instance.CopyTo(array, index)
public virtual void CopyTo( 
   Array array,
   int index
)

Parameters

array
One-dimensional array into which are copied the elements from ICollection (The array must have zero-based indexing.)
index
Zero-based index in array at which to paste styles
Exceptions
ExceptionDescription
No array specified, or specified array is null (Nothing)
Specified array is not valid; must have a rank of one
Specified array is not valid; must have sufficient length
Specified index is out of range; must be greater than zero
Example
This example copies the named styles in the collection to an array.
FarPoint.Win.Spread.NamedStyleCollection nsc = new FarPoint.Win.Spread.NamedStyleCollection();
FarPoint.Win.Spread.NamedStyle ns1 = new FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault");
FarPoint.Win.Spread.NamedStyle ns2 = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
ns1.BackColor = Color.LightBlue;
ns2.BackColor = Color.Gray;
nsc.AddRange(new Object[] {ns1, ns2});
fpSpread1.NamedStyles = nsc;
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc[0];
fpSpread1.ActiveSheet.DefaultStyle = nsc[1];
object[] myarray = new Object[nsc.Count];
nsc.CopyTo(myarray, 0);
label1.Text = "The name of the first style in the collection " + myarray.GetValue(0).ToString();
Dim nsc As New FarPoint.Win.Spread.NamedStyleCollection()
Dim ns1 As New FarPoint.Win.Spread.NamedStyle("StyleHeaders", "HeaderDefault")
Dim ns2 As New FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault")
ns1.BackColor = Color.LightBlue
ns2.BackColor = Color.Gray
nsc.AddRange(New Object() {ns1, ns2})
FpSpread1.NamedStyles = nsc
FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = nsc(0)
FpSpread1.ActiveSheet.DefaultStyle = nsc(1)
Dim myarray(nsc.Count())
nsc.CopyTo(myarray, 0)
Label1.Text = "The name of the first style in the collection " & myarray.GetValue(0).ToString()
See Also

Reference

NamedStyleCollection Class
NamedStyleCollection Members
Overload List