I am writing an ATM program for college and I have command buttons called
cmd1
cmd2
cmd3
...
cmd0
How can I get the button to depress as the user hits the corresponding number key ?
Thanks.
Printable View
I am writing an ATM program for college and I have command buttons called
cmd1
cmd2
cmd3
...
cmd0
How can I get the button to depress as the user hits the corresponding number key ?
Thanks.
if keyascii = 13 then
cmd1_click 'press the command1 button
end if
i assume you have your code in cmd1.. this is not a effecient way of doing it
what ever code you have in the cmd's
put them in functions and procedures
then in cmd1 make the call to this function
and on keypress call the same function..
Where do I put the If statement ? And how would I move from one textbox after its accepted 6 characters onto the next ?
let say you have a textbox called"
txtinput
after you hit ENTER in this you want the cmd to be clicked basically
so in the txtinput's KEYPRESS event
you put the if statement
if you want to automatically move from one textbox after it has 6 chars in it use this in the CHANGE event of the textbox
if len(txtinput.text) => 6 then
txtmyother.setFocus
end if
If you want to jump code from one to the other it's a lot easier if you use a control array of buttons. Attached is a little sample of how it would work...I use only 1 characer and not six but I am changing on index..you can adjust the code to compensate for whatever..it's just the idea of a control array I am offering.