Articles in this section
Category / Section

How to perform undo or redo functionality using HistoryManager property in WinForms TreeViewAdv ?

Undo and Redo

The user should get the HistoryManager to use and then the HistoryEnabled property should be set to true. The HistoryManager plays the role in the Undo or Redo actions.

The Undo and Redo functionality of a TreeViewAdv does the following actions:

1. Deleting a node

2. Adding a node

3. Editing node's Text

4. Drag and drop of a node

C#

private void barItem1_Click(object sender, System.EventArgs e)
{
    if (this.treeViewAdv1.HistoryManager.CanUndo)
    {
        this.treeViewAdv1.HistoryManager.Undo();
    }
}

private void barItem2_Click(object sender, System.EventArgs e)
{
    if (this.treeViewAdv1.HistoryManager.CanRedo)
    {
        this.treeViewAdv1.HistoryManager.Redo();
    }
}

VB

Private Sub barItem1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    If Me.treeViewAdv1.HistoryManager.CanUndo Then
        Me.treeViewAdv1.HistoryManager.Undo()
    End If
End Sub

Private Sub barItem2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    If Me.treeViewAdv1.HistoryManager.CanRedo Then
        Me.treeViewAdv1.HistoryManager.Redo()
    End If
End Sub

Reference link: HistoryManager

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied