+ Reply to Thread
Results 1 to 5 of 5

select a textbox automatically

  1. #1
    Registered User
    Join Date
    09-04-2006
    Posts
    29

    select a textbox automatically

    Hi,

    I have a form that opens up and I want to be able to start typing in a select textbox without having to first use the mouse to click on the textbox to select it.

    I have had a quick look but couldn't get it to work.

    Any ideas??


    Thanks
    Ben

  2. #2
    Registered User
    Join Date
    09-04-2006
    Posts
    29
    Don't worry about it.

    I was trying to set the setfocus property from the wrong place.


    Ben

  3. #3
    Forum Contributor
    Join Date
    04-12-2006
    Location
    Morgan Hill CA
    Posts
    107
    SetFocus seems to work to get the cursor there.

    My question. Can I "select" any TEXT that is already there automatically. Setfocus gets you there but I want to have the text selected... (as if I tabbed into the field)

    Anyway to do that?

  4. #4
    Registered User
    Join Date
    09-04-2006
    Posts
    29
    I tried a few differnet things but none of them got the desired effect. Sorry I couldn't help you

  5. #5
    Forum Contributor
    Join Date
    04-12-2006
    Location
    Morgan Hill CA
    Posts
    107
    Thanks for the effort ben, just found the answer today.

    ' set focus to the text field and highlight it
    Me.txtField1.SetFocus
    Me.txtField1.SelStart = 0
    Me.txtField1.SelLength = Len(Me.txtField1.Text)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1