I would like to use sendkeys to put data in my form.
How can i specify where sendkeys have to put its data?
Greetz
Printable View
I would like to use sendkeys to put data in my form.
How can i specify where sendkeys have to put its data?
Greetz
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:cool:
hope that helps
P.S. I'm sure there's a better way to fill the form you want, what kind is it?
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
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.
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 :)Quote:
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
why on earth do you want to do this... I don't understand... please explain :)
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.
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
try this
hope that works... it worked just fine on my pc :)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
any luck with the sample matje ?