Click here to Skip to main content
15,913,130 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am trying to write a simple form that serves as a keypad which has buttons 1 to 9 and zero.
I want to make the button enter the number into any currently selected text box.

For example

If I have 5 different text boxes and my cursor is selecting the forth one I want to click the button for bumber 5 and get that number put in the selected textbox

Can anyone help me with some simple sample code?

I am working Visual Studio 2010 and developing in windows form

I am very new at this so the simpler the better.

Thank you
Posted

1 solution

Follow below step :
1) Design form which will have 9 keys like num pad
2) on Button click event of each button right below code
C#
SendKeys.Send("A") // Note : Replace "A" with respective button value

Suppose on click event of "1" button write below code
C#
SendKeys.Send("1") // Note : Replace "A" with respective button value

3) Read below blog for more information

http://social.msdn.microsoft.com/Forums/en-ZA/csharplanguage/thread/a01652a5-6fc3-43ce-92dd-fc0d105d47a3[^]

Accept and vote if works otherwise revert back
--RDB
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900