method G2antt.FreezeEvents (Freeze as Boolean)
Prevents the control to fire any event.

 TypeDescription 
   Freeze as Boolean A Boolean expression that specifies whether the control' events are froze or unfroze  
The FreezeEvents(True) method freezes the control's events until the FreezeEvents(False) method is called. You can use the FreezeEvents method to improve performance of the control while loading data into it. For instance, the Change event is fired anytime the cell's value is changed ( CellValue property ), so during init time, you can call FreezeEvents(True) before, and FreezeEvents(False) after initialization is done.

The following samples show how you can lock the events while adding columns, items to the control:

' Change event - Occurs when the user changes the cell's content.
Private Sub G2antt1_Change(ByVal Item As EXG2ANTTLibCtl.HITEM,ByVal ColIndex As Long,NewValue As Variant)
	With G2antt1
		Debug.Print( "Change event" )
	End With
End Sub

With G2antt1
	.FreezeEvents True
	.BeginUpdate 
	With .Columns
		.Add("C1").Def(exCellHasCheckBox) = True
		.Add "C2"
	End With
	With .Items
		.CellValue(.AddItem("SubItem 1.1"),1) = "SubItem 1.2"
		.CellValue(.AddItem("SubItem 2.1"),1) = "SubItem 2.2"
	End With
	.EndUpdate 
	.FreezeEvents False
End With

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.