Results 1 to 5 of 5

Thread: [2005] Code for a keystroke

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    60

    [2005] Code for a keystroke

    Can someone please tell me what the code is for a keystroke?

    eg I was following a VB 6 tutorial on a program and it had this code in it:

    SendKeys Text1.Text

    it is supposed to type the text into the specified window of whatever text is in Text1 but I am assuming the SendKeys code has changed since VB 6 because it comes up an error now. Can some please post the VB 2005 code for the same axction?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2005] Code for a keystroke

    VB Code:
    1. System.Windows.Forms.SendKeys.Send("A")

    I would suggest searching the MSDN before posting questions. It should show this method in the first few results.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Re: [2005] Code for a keystroke

    System.Windows.Forms.SendKeys.Send(Textbox1.text) ...in .net it's textbox not just text1

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2005] Code for a keystroke

    Quote Originally Posted by OMITT3D
    System.Windows.Forms.SendKeys.Send(Textbox1.text) ...in .net it's textbox not just text1
    Um, Textbox1, textbox, and text1 are just names that the programmer created. He can call it text1 all he wants.

    I can name a TextBox MySuPeRaNnOyInGaLtErNaTiNgCaPsVaRbOx

    System.Windows.Forms.SendKeys.Send(MySuPeRaNnOyInGaLtErNaTiNgCaPsVaRbOx.Text) works just fine
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    60

    Re: [2005] Code for a keystroke

    thanks for all the help, I had never used msdn before but it semms helpful, from what i have used you dont actuall need the "system.windows.forms" part, just using "SendKeys.Send(textbox1.text)" worked for me

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