calculator accept "/" and "+" when I press from keyboard numlock
-
I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy
-
I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy
Handle the form's KeyPress[^] event.
KeyEventArgs.KeyCode
gives you the current key which is pressed.Navaneeth How to use google | Ask smart questions
-
I am new to VB 2008, and I am learning this new language VB. The project I started to write a small program Calculator that will do just like a real calculator on (Windows XP). I ran in some problems when I am trying to write routine to accept "/" divide, "+" plus, and "-" minus from right side of the keyboard. with press NUMLOCK ON. When I press NUMLOCK ON, the program should accept the "/", "*", "-", "+" and perform arithmetic. My program calculator now can accept "/", "*", "-" when I used the mouse to press buttons on the calculator's interface. Can someone tell me what the code will be? I am stuck...and I need help.. how to write the routine that will accept the operand to perform the basic arithmetic thanks for everyone can help!! Andy
From the KeyDown Event, you can check if e.KeyCode =Keys.NumLock or e.keycode=Keys.NumPad0 or...whatever else as per the need.