Make Visual Basic to press a key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Virox
    New Member
    • Jul 2007
    • 2

    Make Visual Basic to press a key

    I don't know how to make visual basic press a key using code, can someone help me?!
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    It sounds as though you're probably looking for the SendKeys function. How it works depends on what version of VB you are using, but check your documentation.

    Comment

    • Mague
      New Member
      • May 2007
      • 137

      #3
      Most the time all you have to do is put this code
      Code:
      sendkeys(string)
      I found for some reason this didnt work on my visual studio 2005 so if it doesnt try this
      Code:
      sendkeys.send(string)
      Hope this helped
      Mague

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by Virox
        I don't know how to make visual basic press a key using code, can someone help me?!
        Code:
        strKey = "{<Key Name>}"  in VB 6.0
        
        sendkeys strKey
        This will do. Just throw the versions in the questions that you are using .

        Comment

        • Virox
          New Member
          • Jul 2007
          • 2

          #5
          Thanks a lot, that was what i was looking for.
          I use visual basic 6

          Comment

          Working...