Spread Windows Forms 6.0 Product Documentation
Clear Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyleCollection Class : Clear Method


Glossary Item Box

Removes all named styles from the collection.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub Clear() 
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollection
 
instance.Clear()
C# 
public virtual void Clear()

Example

This example removes all the named styles from the NamedStyleCollection object.
C#Copy Code
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 clear the styles from the collection?", "Clear", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
nsc.Clear();
label1.Text = "There are " + nsc.Count.ToString() + " named styles in the collection.";
}
Visual BasicCopy Code
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 clear the styles from the collection?", "Clear", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
nsc.Clear()
Label1.Text = "There are " & nsc.Count.ToString() & " named styles in the collection."
End If

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.