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


index
Index in the collection at which to add the filter
filterItem
Custom filter item to add

Glossary Item Box

Inserts a filter item into the collection at a specified location.

Syntax

Visual Basic (Declaration) 
Public Sub Insert( _
   ByVal index As Integer, _
   ByVal filterItem As IFilterItem _
) 
Visual Basic (Usage)Copy Code
Dim instance As FilterItemCollection
Dim index As Integer
Dim filterItem As IFilterItem
 
instance.Insert(index, filterItem)
C# 
public void Insert( 
   int index,
   IFilterItem filterItem
)

Parameters

index
Index in the collection at which to add the filter
filterItem
Custom filter item to add

Exceptions

ExceptionDescription
System.ArgumentOutOfRangeException Specified index is out of range; must be between 0 and the total number of filters in the collection
System.ArgumentException No display name or length of the display name of the specified custom filter is zero
System.ArgumentException No specified custom filter or specified custom filter is null
System.ArgumentException Specified custom filter display name already exists in the collection; the name must be unique

Example

This example returns the filters applied for filtering.
C#Copy Code
FarPoint.Win.Spread.NamedStyle instyle = new FarPoint.Win.Spread.NamedStyle(); 
FarPoint.Win.Spread.NamedStyleim outstyle = new FarPoint.Win.Spread.NamedStyle(); 
instyle.BackColor = Color.Yellow; 
outstyle.BackColor = Color.Aquamarine; 
FarPoint.Win.Spread.FilterColumnDefinition fcd = new FarPoint.Win.Spread.FilterColumnDefinition(1, FarPoint.Win.Spread.FilterListBehavior.SortByMostOccurrences
| FarPoint.Win.Spread.FilterListBehavior.Default); 
FarPoint.Win.Spread.FilterColumnDefinition fcd1 = new FarPoint.Win.Spread.FilterColumnDefinition(2); 
FarPoint.Win.Spread.FilterColumnDefinition fcd2 = new FarPoint.Win.Spread.FilterColumnDefinition(); 
FarPoint.Win.Spread.StyleRowFilter sf = new FarPoint.Win.Spread.StyleRowFilter(fpSpread1.ActiveSheet, instyle, outstyle);

sf.AddColumn(fcd); 
sf.AddColumn(fcd1); 
sf.AddColumn(fcd2);  
fpSpread1.ActiveSheet.RowFilter = sf; 
FarPoint.Win.Spread.FilterItemCollection fc; 
fc = fcd.Filters; 

foreach(FarPoint.Win.Spread.DefaultFilterItem df in fc)
{
     fc.Add(df);
}
Visual BasicCopy Code
Dim instyle As New FarPoint.Win.Spread.NamedStyle
Dim outstyle As New FarPoint.Win.Spread.NamedStyle
instyle.BackColor = Color.Yellow
outstyle.BackColor = Color.Aquamarine
Dim fcd As New FarPoint.Win.Spread.FilterColumnDefinition(1, FarPoint.Win.Spread.FilterListBehavior.SortByMostOccurrences
Or FarPoint.Win.Spread.FilterListBehavior.Default)
Dim fcd1 As New FarPoint.Win.Spread.FilterColumnDefinition(2)
Dim fcd2 As New FarPoint.Win.Spread.FilterColumnDefinition

Dim sf As New FarPoint.Win.Spread.StyleRowFilter(FpSpread1.ActiveSheet, instyle, outstyle)
sf.AddColumn(fcd)
sf.AddColumn(fcd1)
sf.AddColumn(fcd2)
FpSpread1.ActiveSheet.RowFilter = sf

Dim fc As FarPoint.Win.Spread.FilterItemCollection
fc = fcd.Filters
Dim df As FarPoint.Win.Spread.DefaultFilterItem
df = fcd.Filters(0)
fc.Insert(0, df)

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.