Results 1 to 7 of 7

Thread: How do I get the API after setting a text box to goto the last word in the text box?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    How do I get the API after setting a text box to goto the last word in the text box?

    I'm having a problem with figuring this out so, how would I goto the last word in a textbox after setting the text box text? For example I put the text "lala" into a textbox and it'll put the cursor to the beginning of the text how would I get the cursor to goto the end instead of the beginning?

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    Hai,
    if its your own vb app then,
    Code:
    Me.Text1.SelStart = Len(Me.Text1.Text)
    Me.Text1.SelLength = 1

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    I'm coding API for someone elses application and want to know how to get the cursor to the end of there textbox after it places text in it

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    oh is it,
    hm, ill check it. did you check with spy++ for what messages are send when do such a thing. ok ill come back if i got a solution

    May be there should be a simple way

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    OK,
    Code:
    SendMessage(hwnd,WM_KEYDOWN,VK_END,0)
    Should be working fine

  6. #6
    New Member
    Join Date
    Aug 2008
    Posts
    8

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    Don't forget to put in
    vb Code:
    1. const VK_END = 35
    before the code

  7. #7
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How do I get the API after setting a text box to goto the last word in the text box?

    Or you could use the EM_SETSEL message.
    http://support.microsoft.com/kb/109550
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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