在标签上的文本框中选择文本 [英] select text in textbox on tab
本文介绍了在标签上的文本框中选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从一个控件切换到另一个控件(文本框)时,我想选择该文本框内的所有文本吗?
谢谢,
kk
when i tab from one control to another(textbox), then i want to select all text within that textbox?
thanks,
kk
推荐答案
KK,
我尝试在Windows窗体中使用文本框(textbox1).
当textbox1失去焦点时,将选择textboxt1中的内容
为您提供的示例代码:
Hi KK,
I tried with a text boxe(textbox1)in windows forms.
When textbox1 lost its focus, the content in the textboxt1 is selected
Sample code for you:
private void textBox1_Leave(object sender, EventArgs e)
{
//Selects the content in the first control
textBox1.SelectAll();
}
希望这会有所帮助.
编程愉快!!!
Hope this will help.
Happy programming!!!!
您必须在每个文本框和事件处理程序代码中添加Onfocus事件
设置所有选定的文本,如下所示:
You have to add Onfocus event in each textbox and in the event handler code
set all text selected as follows:
<asp:textbox onfocus="javascript:this.select();" id="txt1" runat="server" xmlns:asp="#unknown" />
这篇关于在标签上的文本框中选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文