文本框焦点问题 [英] textbox focus problem

查看:95
本文介绍了文本框焦点问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows应用程序(winforms)上工作,但以下代码有问题
textBox1.Text =嗨";


在将文本集中显示在文本框中之后,这里必须将焦点移到字符串的末尾.如果我设置了textBox1.Focus();属性焦点未移至字符串末尾.

i worked on windows application(winforms) i got a problem with below code
textBox1.Text = "Hi";


here after displaying text in a text box focused must be shift to end of the string. In case of i set textBox1.Focus(); property focus not shifted to end of the string. how to handle it?

推荐答案

尝试:
myTextBox.Text = "Hi";
myTextBox.Focus();
myTextBox.SelectionStart = myTextBox.Text.Length;


这篇关于文本框焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆