Results 1 to 10 of 10

Thread: sendkeys

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Belgium (Bruges)
    Posts
    88

    Unhappy sendkeys

    I would like to use sendkeys to put data in my form.

    How can i specify where sendkeys have to put its data?

    Greetz
    Greetz matthias

  2. #2
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    the sendkeys will put "yours keys" onto the active txtbox

    so u need to make sure where u want it to go is active!

    this can be done by sending the TAB key untill the box u want has the focus

    hope that helps
    Sanj

  3. #3
    rsitogp
    Guest
    P.S. I'm sure there's a better way to fill the form you want, what kind is it?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Belgium (Bruges)
    Posts
    88
    Now i tried this code

    If i press a button of the keyboard it should put a 5 in de textbox.

    Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)
    txtkort(intevullen).SetFocus
    SendKeys "5", False
    end sub


    but it's loop
    Greetz matthias

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Belgium (Bruges)
    Posts
    88
    I just want to use a touch screen, keyboard and barcode scanner in my application.

    And all the data can be entered in the 3 ways.
    Greetz matthias

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Originally posted by matje
    Now i tried this code

    If i press a button of the keyboard it should put a 5 in de textbox.

    Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)
    txtkort(intevullen).SetFocus
    SendKeys "5", False
    end sub


    but it's loop
    it loops... not a surprice, when you put the code in the KeyDown event, and in the keydown event you tell it to sendkey ... it will loop forever

    why on earth do you want to do this... I don't understand... please explain
    -= a peet post =-

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Belgium (Bruges)
    Posts
    88
    Well,

    I would like to enter the data with a keyboard and also with a touchscreen so each command button of the form has to fill up the keyboard buffer just like you should press a key on the keyboard.

    Do you understand?

    An example

    when i press 3 * (buttons on the form) on the touchscreen and i scan an article, it means that i want to sell 3 times the article.
    so i don't have to scan 3 times the same.
    Greetz matthias

  8. #8
    Addicted Member
    Join Date
    Apr 2000
    Location
    England
    Posts
    246
    I fail to Understand aswell

    here is too other methods:
    Code:
    Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer) 
    
    txtKort(intevullen).text = 5
    
    end sub 
    
    Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer) 
    
    txtKort(intevullen).setfocus
    keycode = 53
    end sub
    Some Days, i just get this feeling that i'm helping to write dozens of Viruses...

  9. #9
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    try this

    Code:
    Private Sub Form_Keydown(KeyCode As Integer, Shift As Integer)
        Me.KeyPreview = False
        DoEvents
        Text1.SetFocus
        SendKeys "5", False
        DoEvents
        Me.KeyPreview = True
    End Sub
    hope that works... it worked just fine on my pc
    -= a peet post =-

  10. #10
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    any luck with the sample matje ?
    -= a peet post =-

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