Spread Windows Forms 7.0 Product Documentation
Type Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyleCollectionEventArgs Class : Type Property


Glossary Item Box

Gets the type of event that occurred.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Type As NamedStyleCollectionEventType
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollectionEventArgs
Dim value As NamedStyleCollectionEventType
 
value = instance.Type
C# 
public NamedStyleCollectionEventType Type {get;}

Property Value

NamedStyleCollectionEventType setting containing the type of event

Example

This example returns if an item has been added to the collection.
C#Copy Code
FarPoint.Win.Spread.NamedStyleCollection nsc;

FarPoint.Win.Spread.NamedStyle[] ns = {new FarPoint.Win.Spread.NamedStyle("Style1"),
new FarPoint.Win.Spread.NamedStyle("Style2"),
new FarPoint.Win.Spread.NamedStyle("Style3")};

private void Form1Load(object sender, System.EventArgs e)
{
    nsc = new FarPoint.Win.Spread.NamedStyleCollection();

    this.nsc.Changed += new FarPoint.Win.Spread.NamedStyleCollectionEventHandler(this.nscChanged); 

    ns[0].Font = new Font("Comic Sans Serif", 12);
    ns[0].Name = "StyleHeaders";
    ns[0].Parent = "HeaderDefault";

    nsc.AddRange(ns);

    fpSpread1.NamedStyles = nsc;
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns[0];
}

private void button1Click(object sender, System.EventArgs e)
{
    ns[1].Font = new Font("MS Sans Serif", 12);
    ns[1].Name = "StyleHeaders2";

    nsc.Add(ns[1]);

    fpSpread1.NamedStyles = nsc;
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns[1];

}

private void nscChanged(object sender, FarPoint.Win.Spread.NamedStyleCollectionEventArgs e) 
{ 
    try
    {
        MessageBox.Show(e.Type.ItemAdded.ToString());
    }
    catch (Exception ex)
    {
        MessageBox.Show("No Old Style to Report");
    } 
}
Visual BasicCopy Code
Friend WithEvents nsc As FarPoint.Win.Spread.NamedStyleCollection

Dim ns As FarPoint.Win.Spread.NamedStyle() = {New FarPoint.Win.Spread.NamedStyle("Style1"), 
New FarPoint.Win.Spread.NamedStyle("Style2"), 
New FarPoint.Win.Spread.NamedStyle("Style3")}

Private Sub Form1Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    nsc = New FarPoint.Win.Spread.NamedStyleCollection

    Dim eh As FarPoint.Win.Spread.NamedStyleCollectionEventHandler = AddressOf nscChanged
    AddHandler nsc.Changed, eh

    ns(0).Font = New Font("Comic Sans Serif", 12)
    ns(0).Name = "StyleHeaders"
    ns(0).Parent = "HeaderDefault"

    nsc.AddRange(ns)

    FpSpread1.NamedStyles = nsc
    FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns(0)

End Sub

Private Sub nscChanged(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.NamedStyleCollectionEventArgs) Handles nsc.Changed
    Try
        MessageBox.Show(e.Type.ItemAdded.ToString())
    Catch ex As Exception
        MessageBox.Show("No Old Style to Report")
    End Try
End Sub

Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ns(1).Font = New Font("MS Sans Serif", FontStyle.Bold)
    ns(1).Name = "StyleHeaders2"

    nsc.Add(ns(1))

    FpSpread1.NamedStyles = nsc
    FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = ns(1)

End Sub

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

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