通过代码使用退格键 [英] use backspace by code
本文介绍了通过代码使用退格键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
(现在这不是一个问题,只是一个解决方案)
嗨!
我知道如何在textBox(\ r \ n)中创建新段落,但我想知道如何在textBox和
中使用< ;-(退格)
它的代码是什么?
谢谢
解决方案:
您可以获得textBox的长度,您应该将子字符串的长度比长度少一:
textBox1.text = textbox1.substring(0, textbox1.text.length - 1)
祝你好运
IMANVS:D oostl
(Now it''s not a question, just a solution)
hi!
I know how to make a new paragraph in a textBox(\r\n) but i want to know how to use <- (back space) in a textBox and
what''s the code of it?
thanks
Solution:
You can get the length of the textBox the you should substring one less than length:
textBox1.text = textbox1.substring(0, textbox1.text.length - 1)
Good Luck
IMANVS :D oostl
推荐答案
您可以使用keypress事件来检查此
You can use keypress event to check this
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 8)
{
//backspace is used... add your logic here..
}
}
这篇关于通过代码使用退格键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文