![]() ![]() ![]() |
![]() |
SGCondition Object |
Name: | SGCondition |
Description: | SGCondition object represents condition used by other SGGrid objects. |
GUID: | {86F749D3-360F-11D3-B736-008048E27A77} |
The following example uses Between operator for row filtering. When you click on the button, it increases the Condition members Value1 and Value2 by 100 and applies new filter. To try the example, place SGGrid and CommandButton control on a form. Paste the code into the Declarations section, press F5 and click button.
Private Sub Command1_Click()
Dim cnd As SGCondition
Dim sColKey As String
sColKey = SGGrid1.Columns(1).Key
With SGGrid1.RowFilters
'clear last filter action
.ClearMarkers .FilterAction
'create filter object on the
'first call
If .Count = 0 Then _
Call .Add("Filter", sColKey, sgOpBetween, -100, 0)
End With
Set cnd = SGGrid1.RowFilters("Filter").Condition
'increase range in the filter criteria
If cnd.Value2 = 1000 Then
cnd.Value1 = -100
cnd.Value2 = 0
End If
cnd.Set sgOpBetween, cnd.Value1 + 100, cnd.Value2 + 100
'apply filter action
SGGrid1.RowFilters.Apply sgFilterActionSelect
Set cnd = Nothing
End Sub
Private Sub SGGrid1_OnInit()
Dim i As Integer
With SGGrid1
'create rows and cols
.DataColCount = 1
.DataRowCount = 50
'hide GroupByBox
.GroupByBoxVisible = False
'fill grid's array with random data
For i = 0 To .DataRowCount - 1
.Array.Value(i, 0) = CLng(Rnd * 1000)
Next
'customize the FilteredRow style
.Styles("FilteredRow").BackColor = vbBlack
.Styles("FilteredRow").ForeColor = vbGreen
End With
Command1_Click
End Sub
Referenced By
SGStyleCondition.Condition | SGCalculation.Condition | SGFilter.Condition