怎么样使文本框里的内容成为全选
怎么样判断是否得到了焦点

解决方案 »

  1.   


    Option ExplicitPrivate Sub Text1_GotFocus()
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
    Debug.Print Form1.ActiveControl.Name
    End Sub
      

  2.   

    同意楼上的,不过有时候假设几个字符也没有使用Text1.SelLength回出错,建议加上错误陷阱,或用If语句判断下Len(Text1.text)
      

  3.   

    Private Sub Text2_GotFocus()
        Text2.SelStart = 0
        Text2.SelLength = Len(Trim(Text2.Text))
    End Sub
      

  4.   

    to withpointer(NewOne) :
    一个字符也没有也不会出错啊,选中长度为0,什么都不选。  :)
      

  5.   

    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)