method Items.EndUpdateBar (StartUpdateBar as Long)
Adds programmatically updated properties of the bar to undo/redo queue.

TypeDescription
StartUpdateBar as Long A long expression that specifies the handle being returned by the StartUpdateBar property.
Use the StartUpdateBar and EndUpdateBar methods to add new entries in the chart's undo/redo queue for properties of the bar being updated by code. The ItemBar property accesses the properties of the bar. For instance, if your application provides UI dialogs or forms that help users changing the properties of the selected bar such as color, text, tooltips and so on, you can provide undo/redo operations for them by using the StartUpdateBar and EndUpdateBar methods. Shortly, the StartUpdateBar method starts recording the properties being changed until the EndUpdateBar method is called. The EndUpdateBar method actually adds a new entry to the undo/redo queue based on the changed properties. If there were no changes of the bar during the Star/End session, no new entry is added. The EndUpdateBar method adds UpdateBar entries to the undo/redo queue. 

The AllowUndoRedo property specifies whether the chart supports undo/redo operations for objects in the chart such as bars or links. The ChartStartChanging(exUndo/exRedo) / ChartEndChanging(exUndo/exRedo) event notifies your application whenever an Undo/Redo operation is performed. The UndoListAction property lists the Undo actions that can be performed in the chart. The RedoListAction property lists the Redo actions that can be performed in the chart.

The following VB sample adds a new entry "UpdateBar" in the chart's undo/redo queue for changing the text of the bar ( /COM version ):

 With G2antt1.Items
    Dim hItem As Long
    hItem = .FocusItem
    Dim barKey As Variant
    barKey = .FirstItemBar(hItem)
    
    Dim iChangeBar As Long
    iChangeBar = .StartUpdateBar(hItem, barKey)
    .ItemBar(hItem, barKey, exBarCaption) = "new caption"
    .EndUpdateBar (iChangeBar)
End With

The following VB/NET sample adds a new entry "UpdateBar" in the chart's undo/redo queue for changing the text of the bar ( /NET Assembly version ):

With Exg2antt1.Items
    Dim hItem As Long = .FocusItem
    Dim barKey As Object = .get_FirstItemBar(hItem)

    Dim iChangeBar As Long = .get_StartUpdateBar(hItem, barKey)
    .set_ItemBar(hItem, barKey, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCaption, "new caption")
    .EndUpdateBar(iChangeBar)
End With

These samples add new entries to undo/redo queue as : "UpdateBar;94980832;B1;3;;new caption " which indicates , the handle of the items where the bar has been changed, the bar of the key as being B1, the 3 indicates the exBarCaption predefined value, and so on. Once the sample is called, the bar's caption is changed, and using the CTRL + Z, you can restore back the old value, or pressing the CTRL + Y you can change back after restoring.