Results 1 to 3 of 3

Thread: Text Box Help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432

    Red face 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

  2. #2
    Junior Member
    Join Date
    Sep 2002
    Location
    Florida
    Posts
    24
    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)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432
    That would work if i was placing the Control on the Form but im making a Custom Control

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width