none
Undo And Redo RRS feed

  • Question

  • i upgraded my vb.net to the newest version

    and the Undo Redo stoped to work it creates an error massage

       mundu.Enabled = urc.CanUndo
                Redo.Enabled = urc.CanRedo

    were  can i find a code for  Undo And Redo  without a error

    Tuesday, June 30, 2020 3:18 PM

All replies

  • Hello,

    Without the exact error message all we can do is guess. so please provide the error message.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, June 30, 2020 3:50 PM
    Moderator
  •  i need new code thet worked for vb.net 2019 Version 16.6.2

    i sarched and found some samples thet is working in the sample 

    and by copying it the a new project

    it is making an error

    Private UndoStack AsStack(Of T)
    
    Private RedoStack AsStack(Of T)

    the "Of T" is making an error

     

    Tuesday, June 30, 2020 4:00 PM
  •  i need new code thet worked for vb.net 2019 Version 16.6.2

    i sarched and found some samples thet is working in the sample 

    and by copying it the a new project

    it is making an error

    Private UndoStack AsStack(Of T)
    
    Private RedoStack AsStack(Of T)

    the "Of T" is making an error

     

    Hi

         'the "Of T" is making an error'   -   what about the 'AsStack' - is it not also an exception waiting to happen?

    The Of T portion is used as an example - you need to set the Type.

    See HERE




    Regards Les, Livingston, Scotland

    Tuesday, June 30, 2020 4:26 PM
  • Thanks

    can someone show me a sample of undo redo that working in vb.net

     
    Tuesday, June 30, 2020 4:30 PM
  • Thanks

    can someone show me a sample of undo redo that working in vb.net

     

    Like these where the first one is from Microsoft.

    https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.ieditableobject?redirectedfrom=MSDN&view=netcore-3.1

    https://www.codeproject.com/Articles/43436/Undo-Redo-Framework

    https://pradeep1210.wordpress.com/2011/04/09/add-undoredo-or-backforward-functionality-to-your-application/


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, June 30, 2020 4:48 PM
    Moderator
  • thnks

    this samples i tried and got the error

    look the smaple

     Private UndoStack As Stack(Of T)
        Private RedoStack As Stack(Of T)
     
    Tuesday, June 30, 2020 5:08 PM
  • thnks

    this samples i tried and got the error

    look the smaple

     Private UndoStack As Stack(Of T)
        Private RedoStack As Stack(Of T)
     

    Hi

    Did you read the items in the links that both I and Karen posted? All the answers are there!


    Regards Les, Livingston, Scotland

    Tuesday, June 30, 2020 5:20 PM
  • Thanks for your repons

    Look 

    Public Function UndoItems() As List(Of t)
            Return UndoStack.ToList
        End Function

    both are making an error

    List(Of t)

    List is a error

    and of "T"

    if i change "T" to "text" then the error is only on List

    the code needs a list of all items that is undo or redo

    both the is not finished

     

    Tuesday, June 30, 2020 8:17 PM
  • Hi

    Did you read the items in the links that both I and Karen posted? All the answers are there!


    Regards Les, Livingston, Scotland

    Tuesday, June 30, 2020 8:27 PM
  • Thank you for response. However, the sample code you sent was written with an old version of visual Studio, becasue when I opened the sample projects, the message was that I must transfer it to the current version of VS. 

    It is full of errors.

    I asked a question about Undo and Redo. I don't have anything out of the links you sent, because it is not the same version. If you can send a sample project of the current Visual Studio version I may have benefit from it.

    Thank you


    Tuesday, June 30, 2020 8:43 PM
  • Thanks for your repons

    Look 

    Public Function UndoItems() As List(Of t)
            Return UndoStack.ToList
        End Function

    both are making an error

    List(Of t)

    List is a error

    and of "T"

    if i change "T" to "text" then the error is only on List

    the code needs a list of all items that is undo or redo

    both the is not finished

     

    Hi

    Who are you talking to? Can't be me as your post is meaningless to me.

    Why do you NEVER answer any question? I have twice asked if you read the items at the links given to you and both times you just ignored my question. So, in response,I will now ignore your posts.  Bye bye!


    Regards Les, Livingston, Scotland


    • Edited by leshay Tuesday, June 30, 2020 9:00 PM
    Tuesday, June 30, 2020 9:00 PM
  • Hi MosheS Singer,

    As you can see in Karen's third link:

    Add Undo/Redo or Back/Forward Functionality to your Application

    You need a class like:

        Public Class UndoRedoClass(Of T)
        '...
        End Class

    For example:

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, July 1, 2020 7:47 AM
    Moderator
  • thnks

    this samples i tried and got the error

    look the smaple

     Private UndoStack As Stack(Of T)
        Private RedoStack As Stack(Of T)
     

    I don't see any errors

    Public Class UndoRedoClass(Of T)
        Private UndoStack As Stack(Of T)
        Private RedoStack As Stack(Of T)
    
        Public CurrentItem As T
        Public Event UndoHappened As EventHandler(Of UndoRedoEventArgs)
        Public Event RedoHappened As EventHandler(Of UndoRedoEventArgs)
    
        Public Sub New()
            UndoStack = New Stack(Of T)
            RedoStack = New Stack(Of T)
        End Sub
    
        Public Sub Clear()
            UndoStack.Clear()
            RedoStack.Clear()
            CurrentItem = Nothing
        End Sub
    
        Public Sub AddItem(ByVal item As T)
            If CurrentItem IsNot Nothing Then UndoStack.Push(CurrentItem)
            CurrentItem = item
            RedoStack.Clear()
        End Sub
    
        Public Sub Undo()
            RedoStack.Push(CurrentItem)
            CurrentItem = UndoStack.Pop()
            RaiseEvent UndoHappened(Me, New UndoRedoEventArgs(CurrentItem))
        End Sub
    
        Public Sub Redo()
            UndoStack.Push(CurrentItem)
            CurrentItem = RedoStack.Pop
            RaiseEvent RedoHappened(Me, New UndoRedoEventArgs(CurrentItem))
        End Sub
    
        Public Function CanUndo() As Boolean
            Return UndoStack.Count > 0
        End Function
    
        Public Function CanRedo() As Boolean
            Return RedoStack.Count > 0
        End Function
    
        Public Function UndoItems() As List(Of T)
            Return UndoStack.ToList
        End Function
    
        Public Function RedoItems() As List(Of T)
            Return RedoStack.ToList
        End Function
    End Class
    
    Public Class UndoRedoEventArgs
        Inherits EventArgs
    
        Private _CurrentItem As Object
        Public ReadOnly Property CurrentItem() As Object
            Get
                Return _CurrentItem
            End Get
        End Property
    
        Public Sub New(ByVal currentItem As Object)
            _CurrentItem = currentItem
        End Sub
    End Class


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, July 1, 2020 12:33 PM
    Moderator