如何使用按钮在文本框中添加和插入文本 [英] How to append as well as insert text in textbox using a button
本文介绍了如何使用按钮在文本框中添加和插入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的项目编程一个虚拟键盘.在按钮A上,我写的代码为
Hi,
I am programming a virtual keyboard for my project. On a button A, i written a code as
Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
txtpatname.Text = txtpatname.Text.Insert(txtpatname.SelectionStart, "a")
End Sub
使用此代码,每次我必须选择文本框然后单击按钮A时(即不附加按钮),它将直接在文本框的开头显示光标.
任何帮助将不胜感激.
在此先谢谢您.
With this code, everytime I have to select textbox and then click on Button A i.e it not appending, it is showing cursor directly at start of the textbox.
Any help will be kindly appreciated.
Thanks in advance.
推荐答案
您好,请尝试以下操作:
Hi, try this:
Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btna.Click
txtpatname.Text = txtpatname.Text + "a"
End Sub
这篇关于如何使用按钮在文本框中添加和插入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文