Results 1 to 3 of 3

Thread: textbox.set focus is not working - why?

  1. #1

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Angry textbox.set focus is not working - why?

    Hello Everybody,
    I'm trying to set focus to a text box,but i'm getting error message

    "Run-time error '5': invalid procedure call or argument"

    what i'm trying to do is to select the text in the text box and highlight it ,so if the user will press any key he will see the new key (character).

    maybe setfocus is not what i need.

    So, if someone know the answer please reply,
    thank you all in advance,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Public Sub SelectAllText(TheForm As Form)
    2. 'rmg
    3. 'the purpose of this sub routine is to select all text in a text box on an edit
    4.             TheForm.ActiveControl.SelStart = 0
    5.             TheForm.ActiveControl.SelLength = Len(TheForm.ActiveControl.Text)
    6. End Sub
    7.  
    8. 'To use, place this in the Got_Focus event of a Text box:
    9. SelectAllText Me

  3. #3

    Thread Starter
    Hyperactive Member eranfox's Avatar
    Join Date
    May 2001
    Posts
    492

    Reply to Hack

    Dear Hack,
    Thank you for your reply,
    I used this code of yours from another thread.
    Thank you again,
    ERAN
    Eran Fox
    ASSEMBLER,C,C++,VB6,SQL...

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