ActiveReports 19 .NET Edition
MESCIUS.ActiveReports.Design.Win Assembly / GrapeCity.ActiveReports.Design Namespace / UndoManager Class / Undo Method
Example

In This Topic
    Undo Method
    In This Topic
    Undoes the last action.
    Syntax
    'Declaration
     
    Public Sub Undo() 
    public void Undo()
    Remarks
    This method reverts the last action that was recorded in the undo stack, effectively "undoing" the most recent change made by the user. After the operation is undone, it is moved to the redo stack, allowing it to be redone if necessary. The Changed event is raised to notify subscribers that the state of the undo/redo history has changed.
    Example
    // <summary>
    /// tbStandard_ButtonClick - calls ExecuteDesignerAction, or the associated function
    /// based on the button clicked.
    /// </summary>
    private void tbStandard_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
    {
        if((string)e.Button.Tag == "NewReport")  //New Report was Clicked
        {
            this.ardMain.NewReport();
            this.FillCombo();
        }
        if((string)e.Button.Tag == "Open")  //Open Report was Clicked
        {
            this.OpenReportFile();
        }
        if((string)e.Button.Tag == "Save")  //Save Report was Clicked
        {
            this.SaveReportFile();
        }
        if((string)e.Button.Tag == "SaveAs")  //SaveAs was Clicked
        {
            this.SaveAsReportFile();
        }
        if((string)e.Button.Tag == "ReportSettings")  //ReportSettings was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.ReportSettings);
        }
        if((string)e.Button.Tag == "Undo")  //Undo was Clicked
        {
            this.ardMain.UndoManager.Undo();
        }
        if((string)e.Button.Tag == "Cut")  //Cut was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditCut);
        }
        if((string)e.Button.Tag == "Copy")  //Copy was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditCopy);
        }
        if((string)e.Button.Tag == "Paste")  //Paste was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditPaste);
        }
        if((string)e.Button.Tag == "Delete")  //Delete was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.EditDelete);
        }
        if((string)e.Button.Tag == "ReorderGroups")  //ReorderGroups was Clicked
        {
            this.ardMain.ExecuteAction(DesignerAction.ReorderGroups);
        }    
    }
    'tbStandard_ButtonClick - calls ExecuteDesignerAction, or the associated function
    'based on the button clicked.
    Private Sub tbStandard_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbStandard.ButtonClick
        If CStr(e.Button.Tag) = "NewReport" Then 'New Report was Clicked
            Me.ardMain.NewReport()
            Me.FillCombo()
        End If
        If CStr(e.Button.Tag) = "Open" Then 'Open Report was Clicked
            Me.OpenReportFile()
        End If
        If CStr(e.Button.Tag) = "Save" Then 'Save Report was Clicked
            Me.SaveReportFile()
        End If
        If CStr(e.Button.Tag) = "SaveAs" Then 'SaveAs was Clicked
            Me.SaveAsReportFile()
        End If
        If CStr(e.Button.Tag) = "ReportSettings" Then 'ReportSettings was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.ReportSettings)
        End If
        If CStr(e.Button.Tag) = "Undo" Then 'Undo was Clicked
            Me.ardMain.UndoManager.Undo()
        End If
        If CStr(e.Button.Tag) = "Cut" Then 'Cut was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditCut)
        End If
        If CStr(e.Button.Tag) = "Copy" Then 'Copy was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditCopy)
        End If
        If CStr(e.Button.Tag) = "Paste" Then 'Paste was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditPaste)
        End If
        If CStr(e.Button.Tag) = "Delete" Then 'Delete was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.EditDelete)
        End If
        If CStr(e.Button.Tag) = "ReorderGroups" Then 'ReorderGroups was Clicked
            Me.ardMain.ExecuteAction(DesignerAction.ReorderGroups)
        End If
    End Sub 'tbStandard_ButtonClick
    See Also