简体   繁体   中英

Textbox Delete Button not Undoing

Basically the code below deletes the selected text from a textbox, although you cannot undo it. Any help on making it undo?

TextBox1.SelectedText = ""

Try a variation of the following...

Public Class Form1
    Dim selText as String

    Private Sub Button1_Click(sender as object, e as EventArgs) Handles Button1.Click
        selText = TextBox1.SelectedText
        TextBox1.SelectedTexxt = ""
    End Sub

    Private Sub Button2_Click(sender as object, e as EventArgs) Handles Button2.Click
        TextBox1.AppendText(selText)
    End Sub
End Class

Found an answer. Just use this code below

SendKeys.Send("{BS}")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM