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


style
Style (NamedStyle object) for which to search

Glossary Item Box

Returns the index of the specified style in the collection.

Syntax

Visual Basic (Declaration) 
Public Overridable Function IndexOf( _
   ByVal style As NamedStyle _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As NamedStyleCollection
Dim style As NamedStyle
Dim value As Integer
 
value = instance.IndexOf(style)
C# 
public virtual int IndexOf( 
   NamedStyle style
)

Parameters

style
Style (NamedStyle object) for which to search

Return Value

Zero-based Integer index of style in the collection

Example

This example illustrates the use of this member by returning the index of one of the named styles in the collection.
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");
int i;
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];
i = nsc.IndexOf(ns2);
label1.Text = "The index of StyleData in the collection is " + i.ToString();
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 i As Integer
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)
i = nsc.IndexOf(ns2)
Label1.Text = "The index of StyleData in the collection is " & i.ToString()

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.