光标在文本框中的位置 [英] Cursor position in TextBox

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

问题描述

我已经创建了asp.net c#Web应用程序框架4.5

当我运行它时,它总是会增加长度,并且用户必须使用箭头键返回到文本框的开始.
简而言之,我想默认在文本框的开始位置设置光标的位置.

谁能告诉我如何在TextBox中设置光标的位置?
thanx

I have created asp.net c# web application framework 4.5

when I run it, it always gives greater length and user have to use arrow keys to go back to start of textbox.
In short I want to set the position of cursor at start of textbox by default.

would any one tell me how to set the position of cursor in TextBox?
thanx

推荐答案

对我来说效果不错.
private void Form1_Load(object sender, EventArgs e)
{
        this.textBox1.SelectionStart = 0;
        textBox1.Focus();

}


轻松:MSDN来了! http://msdn.microsoft.com/en-us/library/ms752349.aspx [ ^ ]
Easy: MSDN to the rescue! http://msdn.microsoft.com/en-us/library/ms752349.aspx[^]


这篇关于光标在文本框中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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