![]() | 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 G2antt1
.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 G2antt1_ValidateValue(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, ByVal NewValue As Variant, Cancel As Boolean)
With G2antt1.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 G2antt1
.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 G2antt1_ValidateValue(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long, ByVal NewValue As Variant, Cancel As Boolean)
With G2antt1.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_g2antt.BeginUpdate(); m_g2antt.SetColumnAutoResize( FALSE ); CColumns columns = m_g2antt.GetColumns(); CColumn column( V_DISPATCH( &columns.Add( "Column 1" ) ) ); CEditor editor = column.GetEditor(); editor.SetEditType( 1 /*EditType*/ ); CItems items = m_g2antt.GetItems(); for ( long i = 0; i < 10; i++ ) items.AddItem( COleVariant( "new item " ) ); m_g2antt.SetCauseValidateValue( TRUE ); m_g2antt.EndUpdate();
In the following VB.NET sample the ValidateValue event is called after loading the items:
With AxG2antt1
.BeginUpdate()
.LinesAtRoot = EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot
.FullRowSelect = False
.DefaultItemHeight = 24
With .Columns.Add("Mask")
With .Editor
.EditType = EXG2ANTTLib.EditTypeEnum.MaskType
.Appearance = EXG2ANTTLib.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:
axG2antt1.BeginUpdate();
EXG2ANTTLib.Columns columns = axG2antt1.Columns;
columns.Add("Column 1");
columns.Add("Column 3");
EXG2ANTTLib.Items items = axG2antt1.Items;
items.AddItem("new item");
items.AddItem("new item");
axG2antt1.CauseValidateValue = true;
axG2antt1.EndUpdate();In the following VFP sample the ValidateValue event is called after loading the items:
with thisform.G2antt1
.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