Results 1 to 5 of 5

Thread: Problem with sendkey

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2004
    Location
    syria
    Posts
    854

    Problem with sendkey

    I tried this sendkey but my PC has frozen. By the way I used XP windows and Microsoft Visual Basic 2005 Express Edition v2.
    vb Code:
    1. Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    2.         System.Windows.Forms.SendKeys.Send("%+")
    3.     End Sub
    Last edited by nader; Oct 11th, 2008 at 08:53 PM.

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Problem with sendkey

    And why are you using SendKeys in the first place? You haven't told us anything other than you're using it and it's crashing your comp
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Problem with sendkey

    As I've said in another of your threads, Shift, Alt and Ctrl are supposed to modify the behaviour of other keys, not produce behaviour of their own. While it doesn't say specifically that you cannot use modifier keys on their own with SendKeys.Send, the documentation does say this:
    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.
    which implies it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2004
    Location
    syria
    Posts
    854

    Re: Problem with sendkey

    Please Take a look to this topic it will expalin what I want to do this.
    http://www.vbforums.com/showthread.php?t=542889

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Problem with sendkey

    The answer has been given to you in those threads, given what you're trying to do, there's no reason to be using SendKeys at all and if you do, it might cause unpredicted results especially if your app looses focus right before it hits the SendKeys line (which would send the keys to the app that does have focus, not yours)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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