Results 1 to 6 of 6

Thread: Setting focus to the end of a text...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Hi, again!

    Is there anyway to set the focus to a text box, at the end of its text?
    Eg.
    Textbox: 95LT
    I'd like the cursor to be after the T, instead of before the 9, in order to avoid having to move through the text too many times.

    Any ideas?
    Thanks in advance,
    Roselene

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    try this:
    Code:
    Text1.SetFocus
    Text1.SelStart = Len(Text1.Text)
    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company



  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Mark,

    It works beautifully. Thanks for taking the time to help me.

    Roselene

  4. #4
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Post

    Hi,
    You can try this also

    SendKeys "{End}"

    Thanks
    karun

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Karun,

    This way works also. I guess we can use this command with other keys:
    SendKeys "{End}"
    SendKeys "{home}"
    SendKeys "{enter}" and so on?

    Thanks for helping,
    Roselene

  6. #6
    Guest

    Post

    From the msdn help.
    If you just want to send letters and stuff, don't enclose them in {}

    Key Code
    BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
    BREAK {BREAK}
    CAPS LOCK {CAPSLOCK}
    DEL or DELETE {DELETE} or {DEL}
    DOWN ARROW {DOWN}
    END {END}
    ENTER {ENTER}or ~
    ESC {ESC}
    HELP {HELP}
    HOME {HOME}
    INS or INSERT {INSERT} or {INS}
    LEFT ARROW {LEFT}
    NUM LOCK {NUMLOCK}
    PAGE DOWN {PGDN}
    PAGE UP {PGUP}
    PRINT SCREEN {PRTSC}
    RIGHT ARROW {RIGHT}
    SCROLL LOCK {SCROLLLOCK}
    TAB {TAB}
    UP ARROW {UP}
    F1 {F1}
    F2 {F2}
    F3 {F3}
    F4 {F4}
    F5 {F5}
    F6 {F6}
    F7 {F7}
    F8 {F8}
    F9 {F9}
    F10 {F10}
    F11 {F11}
    F12 {F12}
    F13 {F13}
    F14 {F14}
    F15 {F15}
    F16 {F16}


    To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:

    Key Code
    SHIFT +
    CTRL ^
    ALT %

    ------------------

    Vincent van den Braken
    EMail: [email protected]
    ICQ: 15440110
    Homepage: http://www.azzmodan.demon.nl




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