在GotFocus时快速选择文本

页面导航:首页 > 软件编程 > vb.net > 在GotFocus时快速选择文本

在GotFocus时快速选择文本

来源: 作者: 时间:2016-02-05 12:32 【

uick Text Select On GotFocusWhen working with data entry controls, the current value in the control often needs to be selected when the control received focus. This allows the

 

uick Text Select On GotFocus

 

When working with data entry controls, the current value in the control often needs to be selected when the control received focus. This allows the user to immediately begin typing over any previous value. Here注释:s a quick subroutine to do just that:

 

Public Sub FocusMe(ctlName As Control)

    注释:

    With ctlName

        .SelStart = 0

        .SelLength = Len(ctlName)

    End With

    注释:

End Sub

 

Now add a call to this subroutine in the GotFocus event of the input controls:

 

Private Sub txtFocusMe_GotFocus()

    Call FocusMe(txtFocusMe)

End Sub

Tags:

相关文章

    文章评论

    最 近 更 新
    热 点 排 行
    Js与CSS工具
    代码转换工具
    
    <