Add Method
Description
Adds a constraint to the GridRecordItem's and/or GridColumn's collection of constraints.
Syntax
Public Sub Add( _
ByVal [Caption](#) As String, _
ByVal [Data](#) As Long _
)
Parameters
- Caption: Text that is displayed to the user for this constraint.
- Data: Numeric data value for this constraint.
Remarks
If a combo button is added, all the constraints that have been added will be displayed in the drop-down list.
If constraints are added to a column, then the list of constraints will be added to each item in that column.
Constraints can also be added to each individual item so that the constraint list can be different for each item in the same column. Constraints added to an individual item will override the constraints added to the column. This way, you can set the entire column to have a specific list of constraints. This might be useful if certain rows of data require a different set of constraints.
Example
Adding Constraints to an Entire Column (Visual Basic)
This sample illustrates how to add constraints to all items in a column.
Dim COLUMN_IMPORTANCE = 1
Dim Column As GridColumn
' Adds a column to the GridControl
Set Column = wndGridControl.Columns.Add(COLUMN_IMPORTANCE, "Importants", 18, False)
' Adds some constraints that will be displayed when the combo button is clicked
' All items in this column will have the same constraints
Column.EditOptions.Constraints.Add "Low", taskImportanceLow
Column.EditOptions.Constraints.Add "Normal", taskImportanceNormal
Column.EditOptions.Constraints.Add "High", taskImportanceHigh
Column.EditOptions.AllowEdit = False
Column.EditOptions.ConstraintEdit = True
' Adds a combo button
Column.EditOptions.AddComboButton
Adding Constraints to a Single GridRecordItem (Visual Basic)
This sample illustrates how to add a list of constraints to an individual GridRecordItem.
Dim Record As GridRecord
Dim Item As GridRecordItem
Set Record = wndGridControl.Records.Add()
Set Item = Record.AddItem("")
' Adds some constraints that will be displayed when the combo button is clicked.
' This list of constraints will override any constraints added to the column this item was added to.
Item.EditOptions.Constraints.Add "Normal", taskImportanceNormal
Item.EditOptions.Constraints.Add "Top Secret", taskImportanceTopSecret
See Also
GridRecordItemConstraints Collection
Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.