![]() | Type | Description | ||
| Boolean | A boolean expression that indicates whether the ValidateValue event is fired before user changes the cell's value. |
Private Sub Command1_Click()
With Grid1
.BeginUpdate
With .Columns.Add("Column 1").Editor
.EditType = EditType
End With
With .Items
.AddItem "Item 1"
.AddItem "Item 2"
End With
.CauseValidateValue = True ' The CauseValidateValue property is called after adding items
.EndUpdate
End With
End Sub
Private Sub Grid1_ValidateValue(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long, ByVal NewValue As Variant, Cancel As Boolean)
With Grid1.Items
Debug.Print "ValidateValue event is called for the cell (" & Item & "," & ColIndex & ")."
End With
End Sub
In this sample the ValidateValue event is not called during adding the items.
In the following VB sample the ValidateValue event is called for each cell during the loading process:
Private Sub Command1_Click()
With Grid1
.BeginUpdate
.CauseValidateValue = True ' The CauseValidareValue property is set on True before loading the items
With .Columns.Add("Column 1").Editor
.EditType = EditType
End With
With .Items
.AddItem "Item 1"
.AddItem "Item 2"
End With
.EndUpdate
End With
End Sub
Private Sub Grid1_ValidateValue(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long, ByVal NewValue As Variant, Cancel As Boolean)
With Grid1.Items
Debug.Print "ValidateValue event is called for the cell (" & Item & "," & ColIndex & ")."
End With
End Sub
In this sample, the ValidateValue event is called during adding the items.
In the following C++ sample the ValidateValue event is called after loading the items:
#include "Editor.h" #include "Column.h" #include "Columns.h" m_grid.BeginUpdate(); m_grid.SetColumnAutoResize( FALSE ); CColumns columns = m_grid.GetColumns(); CColumn column( V_DISPATCH( &columns.Add( "Column 1" ) ) ); CEditor editor = column.GetEditor(); editor.SetEditType( 1 /*EditType*/ ); CItems items = m_grid.GetItems(); for ( long i = 0; i < 10; i++ ) items.AddItem( COleVariant( "new item " ) ); m_grid.SetCauseValidateValue( TRUE ); m_grid.EndUpdate();
In the following VB.NET sample the ValidateValue event is called after loading the items:
With AxGrid1
.BeginUpdate()
.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot
.FullRowSelect = False
.DefaultItemHeight = 24
With .Columns.Add("Mask")
With .Editor
.EditType = EXGRIDLib.EditTypeEnum.MaskType
.Appearance = EXGRIDLib.AppearanceEnum.Etched
.Mask = "{0,255}\.{0,255}\.{0,255}\.{0,255}"
End With
End With
.Items.AddItem("193.226.40.161")
.CauseValidateValue = True
.EndUpdate()
End WithIn the following C# sample the ValidateValue event is called after loading the items:
axGrid1.BeginUpdate();
EXGRIDLib.Columns columns = axGrid1.Columns;
columns.Add("Column 1");
columns.Add("Column 3");
EXGRIDLib.Items items = axGrid1.Items;
items.AddItem("new item");
items.AddItem("new item");
axGrid1.CauseValidateValue = true;
axGrid1.EndUpdate();In the following VFP sample the ValidateValue event is called after loading the items:
with thisform.Grid1
.BeginUpdate
.LinesAtRoot = .t.
.FullRowSelect = .f.
.DefaultItemHeight = 24
With .Columns.Add("Mask")
With .Editor
.EditType = 8
.Appearance = 1
.Mask = "{0,255}\.{0,255}\.{0,255}\.{0,255}"
EndWith
EndWith
.Items.AddItem("193.226.40.161")
.CauseValidateValue = .t.
.EndUpdate
endwith