d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Using Keypress || Click Event For Buttons C#
Add Reply New Topic New Poll
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Feb 24 2013 11:03pm
I'm using click event for a button but I would like to add another event for this button like keypress '9'


Is it possible?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Feb 24 2013 11:15pm
just use the normal keypress event (whatever it's called) and check the keycode of the parameter
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Feb 25 2013 12:04am
i think youre going to have to look into global windows hotkeys if you want this to work outside your form while it is not in focus.

if you want it to work when your form is in focus just create a keypress event for your form -> check which key is pressed (theres a variable when keypress event is created check them) and then call your button function if its the key you want
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Feb 25 2013 01:00am
so do I have to create another function 4 this
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Feb 25 2013 01:07am
srry guy I mean keychar
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Feb 25 2013 06:47pm
anyone?
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Feb 25 2013 09:02pm
iDk much about c sharp but this link seems helpful

http://stackoverflow.com/questions/10484085/get-all-keys-that-are-pressed
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Feb 25 2013 09:10pm
posting your code would help.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll