| Visual Basic (Declaration) | |
|---|---|
Public Overloads Sub CopyTo( _ ByVal array As Array, _ ByVal index As Integer _ )  | |
| Visual Basic (Usage) |  Copy Code | 
|---|---|
Dim instance As DefaultStyleCollection Dim array As Array Dim index As Integer instance.CopyTo(array, index)  | |
Parameters
- array
 - A one-dimensional array into which the elements from ICollection are copied
The array must have zero-based indexing. - index
 - Zero-based index in array at which to paste styles
 
| Exception | Description | 
|---|---|
| System.ArgumentNullException | No array specified, or specified array is null (Nothing) | 
| System.ArgumentException | Specified array is invalid; must have a rank of one | 
| System.ArgumentException | Specified array is invalid; must have sufficient length | 
| System.IndexOutOfRangeException | Specified index is out of range; must be greater than zero | 
This example copies the style to the specified index in an array.
             
            
            | C# |  Copy Code | 
|---|---|
FarPoint.Win.Spread.DefaultStyleCollection dsc = new FarPoint.Win.Spread.DefaultStyleCollection(); Object[] myarray = new Object[dsc.Count]; FarPoint.Win.Spread.StyleInfo si = new FarPoint.Win.Spread.StyleInfo(); foreach(FarPoint.Win.Spread.NamedStyle style in FarPoint.Win.Spread.DefaultStyleCollection.Styles) { listBox1.Items.Add(style.Name); dsc.CopyTo(myarray,0); }  | |
| Visual Basic |  Copy Code | 
|---|---|
Dim dsc As New FarPoint.Win.Spread.DefaultStyleCollection() Dim style As FarPoint.Win.Spread.NamedStyle Dim myarray(dsc.Count()) Dim si As New FarPoint.Win.Spread.StyleInfo() For Each style In dsc.Styles ListBox1.Items.Add(style.Name) dsc.CopyTo(myarray, 0) Next  | |
Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8