method Tree.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 AddItem event occurs once a new item is added to the control's list, 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:

' AddItem event occurs once a new item is added to the control's list
Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM)
    With Tree1
        Debug.Print ("AddItem event")
    End With
End Sub


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