CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    Pakistan
    Posts
    366

    Selecting everything by TAB key

    Hello,
    I am trying to TAB to one text box from another and I want whole of the test to be selected when I TAB into the next field,
    Any Help,
    Thankx in advance


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Selecting everything by TAB key


    private Sub Text1_GotFocus()
    Text1.SelStart = 0
    Text1.SelLength = len(Text1.Text)
    End Sub





  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Selecting everything by TAB key

    Try something like :


    '
    private Sub Text1_GotFocus()
    GotFocus Text1
    End Sub
    '
    private Sub Text2_GotFocus()
    GotFocus Text2
    End Sub
    '
    private Sub GotFocus(oTxt as TextBox)
    on error resume next
    '
    oTxt.SelStart = 0
    oTxt.SelLength = len(oTxt.Text)
    '
    End Sub






    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured