-
Text Box Help
Hello Im working on a Custom TextBox and im Stuck Im trying to have the Custom Control Select All the Text when it get Focus but its not working ??
i have tryied
Code:
Protected Sub OnFocus(ByVal e As System.EventArgs)
Me.SelectAll()
End Sub
Private Sub LemoIP_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Enter
Me.SelectAll()
End Sub
Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
Me.SelectAll()
End Sub
Private Sub LemoIP_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.TextChanged
Me.SelectAll()
End Sub
-
help files say code is:
Private Sub TextBox1_enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
TextBox1.SelectionStart = 0
TextBox1.SelectionLength = TextBox1.Text.Length
'MsgBox(Me.TextBox1.SelectedText)
End Sub
but the only way it seems to work is if the msgbox is not commented out (I added the msgbox to begin with)
-
That would work if i was placing the Control on the Form but im making a Custom Control