使用键盘的退格键删除文本框的最后一个字符的代码 [英] Code for remove last character of textbox using backspace key of keyboard
本文介绍了使用键盘的退格键删除文本框的最后一个字符的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用键盘退格键删除文本框的最后一个字符的代码。
I want to code of remove last character of textbox using keyboard backspace key.
推荐答案
如果你不一定需要使用退格键(模拟)一键打击或你想如何调用它)这将删除文本框中的最后一个字符。
If you don''t necessarily need to use the backspace key (simulate a key punch or how you want to call it) this will do the job of removing the last character in the textbox.
TextBox1.Text = Textbox1.Text.Remove(TextBox1.Text.Count - 1)
我甚至测试了它。
如果文本框中没有文本,可能需要添加if语句(可能会导致错误)。
I even tested it for ya.
You might want to add an if statement in case there is no text in the textbox (it could cause an error).
If Textbox1.Text.Count > 0
TextBox1.Text = Textbox1.Text.Remove(TextBox1.Text.Count - 1)
End If
希望这有帮助!
Hope this helped!
这篇关于使用键盘的退格键删除文本框的最后一个字符的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文