Spread Windows Forms 8.0 Product Documentation
RemoveAt Method (NamedStyleCollection)
Example 


Zero-based index of the style to be removed
Removes a named style (NamedStyle object) from the collection at the specified index.
Syntax
'Declaration
 
Public Overridable Sub RemoveAt( _
   ByVal index As Integer _
) 
'Usage
 
Dim instance As NamedStyleCollection
Dim index As Integer
 
instance.RemoveAt(index)
public virtual void RemoveAt( 
   int index
)

Parameters

index
Zero-based index of the style to be removed
Exceptions
ExceptionDescription
System.IndexOutOfRangeException Specified index is out of range; must be between 0 and the total number in the collection
Example
This example removes the named style at the specified index from the collection.
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");
DialogResult dlg;
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];
label1.Text = "There are " + nsc.Count.ToString() + " named styles in the collection.";
dlg = MessageBox.Show("Do you want to remove StyleHeaders from the collection?", "Remove", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
nsc.RemoveAt(0);
label1.Text = "There are " + nsc.Count.ToString() + " named styles in the collection.";
}
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")
Dim dlg As DialogResult
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)
Label1.Text = "There are " & nsc.Count.ToString() & " named styles in the collection."
dlg = MessageBox.Show("Do you want to remove StyleHeaders from the collection?", "Remove", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
nsc.RemoveAt(0)
Label1.Text = "There are " & nsc.Count.ToString() & " named styles in the collection."
End If
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

Reference

NamedStyleCollection Class
NamedStyleCollection Members

 

 


Copyright © GrapeCity, inc. All rights reserved.