Results 1 to 6 of 6

Thread: Send keys to textbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    http://www.vbforums.com
    Posts
    164

    Send keys to textbox

    Hi, can anyone teach me how to send certain keys to a textbox. Something like sending a key to move to the next line or TAB.

    The line is something like this:
    text1.text = "blah blah blah" & (Enter) & "kay kay kay" & (TAB)

    How do you do just that?

    Thanks!
    "If ignorance is bliss, that probably explain why I'm in a such a mess right now!!"

  2. #2
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485

    Talking

    here you go................


    text1.text = "blah blah blah" & VBCRLF & "kay kay kay" & vbtab
    me.life = VB

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    if you want to send carriage returns and tabs to a textbox you can use the VB constants: vbCrLf and vbTab.

    i.e.
    VB Code:
    1. Text1.Text = "1st line" & vbCrLf & "2nd Line" & vbTab & "Tab!"



    you will also have to set the Textbox's MultiLine property to True if you're going to be adding carriage returns
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    http://www.vbforums.com
    Posts
    164

    Talking

    Thanks a lot, pal!:P
    "If ignorance is bliss, that probably explain why I'm in a such a mess right now!!"

  5. #5
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    hey darre isn't that what i told him

    anyways here is another way you could send some keys

    text1.setfocus
    SendKeys "{Home}+{End}"

    Hope it helps
    me.life = VB

  6. #6
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    Originally posted by deane034
    hey darre isn't that what i told him
    yup although if you look at the post-times, i was probably typing at the same time as you
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

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