怎么设置窗体一启动,当标就在选定的textbox里面.现在的是没有的.需要用鼠标选择有

解决方案 »

  1.   

    设置TextBox的TabOrder为0。在窗体编辑器下,选择菜单View -> TabOrder,就可以调整。
      

  2.   

    只要他的tabindex属性足够小就行了
      

  3.   

    private void Form1_Load(object sender, EventArgs e)
    {
        this.txtNameSpace.Focus();
    }
      

  4.   

    在form_load事件中添加 textbox.focus();
      

  5.   

    有好多的解决办法:TabOrder。Focus。SendKey 都可以,看你具体在什么样的条件,要什么样的效果了。
      

  6.   

    搞错..
    private void Form1_Shown(object sender, EventArgs e)
            {
                textBox1.Focus();
            }上面这个事件
      

  7.   

    很抱歉,有时候.Focus()方法是不会见效果的,这个时候你最好使用异步的方式:this.BeginInvoke((MethodInvoker)delegate{
       txtBox1.Focus();
    });
      

  8.   

    private void Form1_Shown(object sender, EventArgs e)
    你确定这个事件也不行?
      

  9.   

    TabIndex=0,同时在窗体启动过程中不要设置哪个获得光标
      

  10.   

    onload的focus是不起作用的,设置它的tabindex为0,或者在shown事件里做。
      

  11.   

    private void Form1_Load(object sender, EventArgs e)
            {
                this.ActiveControl = textBox1;
            }
      

  12.   

    private void Form1_Load(object sender, EventArgs e) 
            { 
                textBox1.Focus(); 
            }