你需要手工注册这个事件: this.textBox1.GotFocus += new System.EventHandler(this.textBox1_GotFocus); ...... private void textBox1_GotFocus(object sender, System.EventArgs e)
{

}

解决方案 »

  1.   

    事件列表里没有吗?
    双击事件列表里的GotFocus事件,程序会自动增加。
      

  2.   

    关注!!
    我是用C#作WEB开发的,我从来没有找到过这个事件
      

  3.   

    双击事件列表里的GotFocus事件,它便会产生如下的代码:this.textBox1.GotFocus += new System.EventHandler(this.textBox1_GotFocus);这样会往委托链里添加一个新的委托。
      

  4.   

    textbox的事件根据开发程序的类型不同也有不同,对于窗体程序你可用enter,leave,validated等代替!
      

  5.   

    楼上的有道理,用enter事件会有同样的效果.
      

  6.   

    我从来没有在事件中找到过GotFocus事件啊!?怎么双击?是不是由于我做的是Windows程序,所以在事件中找不到GotFocus事件啊?
      

  7.   


     看一楼!
     看一楼! to: 我从来没有在事件中找到过GotFocus事件啊!?怎么双击? 事件列表里没有 但对象信息列表里有(即用点操作符-->textBox1.GotFocus ) 所以你需要手工注册这个事件......
      

  8.   

    我昨晚又试了一下,已经手工注册了的!
    this.textBox1.GotFocus += new System.EventHandler(this.textBox1_GotFocus); ...... private void textBox1_GotFocus(object sender, System.EventArgs e)
    {
        text1Box1.SelectionStar=0;
        text1Box1.SelectionLengh=0;
    }
    为什么不执行中间的代码?
      

  9.   


    private void textBox1_GotFocus(object sender, System.EventArgs e)
    {
    this.Text="ssssss";  //设置标题栏(看看是不是注册事件了)
    }
      

  10.   

    getfocus事件是比较低级的事件,你需要手工注册,就像chNet老兄说得那样
      

  11.   

    getfocus低级的事件?但是由于我才学,所以我想要了解一下啊!我认为C#对初学者来说是不是太难了啊!能否介绍一本对初学者实用的书?!
      

  12.   

    楼上不是有人说是enter事件嘛!
    怎么还不结贴!?