Oppure

Loading
11/08/09 22:55
manvb.net
Ecco, basta che richiami la funzione Undo dal button:

    Dim undostack As New Stack(Of Undos)
    Private Sub TextBox1e2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
        Dim u As New Undos
        u.textname = CType(sender, TextBox).Name
        u.text = CType(sender, TextBox).Text
        undostack.Push(u)
    End Sub
    Private Sub Undo()
        Dim u As Undos
        If undostack.Count = 1 Then
            u = undostack.Pop()
            CType(Me.Controls.Find(u.textname, True)(0), TextBox).ResetText()
            Exit Sub
        End If
        If undostack.Count = 0 Then
            Exit sub
        End If
        undostack.Pop()
        u = undostack.Pop()
        Dim c As TextBox
        c = CType(Me.Controls.Find(u.textname, True)(0), TextBox)
        c.Text = u.text
    End Sub
    Public Structure Undos
        Dim textname As String
        Dim text As String
    End Structure


Sei hai qualche problema a farlo funzionare dimmelo, ma sii chiaro.:D

Edit:
Ho cambiato il nome della funzione perchè in undo perchè undone(traadotto: incompleto) era ridicolo, a volte il sonno fa brutti scherzi...:D.
Ultima modifica effettuata da manvb.net 12/08/09 16:22
aaa
12/08/09 12:29
lorenzo
la prossima volta che non so come chiamare una funzione lo chiedo a te...:D:D:D:D...."undone" :rotfl::rotfl::rotfl::rotfl::rotfl::rotfl::rotfl:
aaa
12/08/09 15:46
manvb.net
Postato originariamente da lorenzo:

la prossima volta che non so come chiamare una funzione lo chiedo a te...:D:D:D:D...."undone" :rotfl::rotfl::rotfl::rotfl::rotfl::rotfl::rotfl:


Vabbe all'una di notte.:D
aaa