11/08/09 22:55
manvb.net
Ecco, basta che richiami la funzione Undo dal button:
Sei hai qualche problema a farlo funzionare dimmelo, ma sii chiaro.
Edit:
Ho cambiato il nome della funzione perchè in undo perchè undone(traadotto: incompleto) era ridicolo, a volte il sonno fa brutti scherzi....
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.
Edit:
Ho cambiato il nome della funzione perchè in undo perchè undone(traadotto: incompleto) era ridicolo, a volte il sonno fa brutti scherzi....
Ultima modifica effettuata da manvb.net 12/08/09 16:22
aaa