Well, The main is that I want to make the program alert me what key was press when that key is pressed. How can I make that
Or If there is a good tutorial for starting programming in C#
Thanks
Well, The main is that I want to make the program alert me what key was press when that key is pressed. How can I make that
Or If there is a good tutorial for starting programming in C#
Thanks
How can I make ....?
MausOnMars
private void e(object sender, KeyPressEventArgs e)
{
String dec = e.KeyChar.ToString();
MessageBox.Show(dec);
}
And it work!!!
Paul Clancy
If you mean a key press across the entire system, then you need to write a system wide hook. Not sure if you can do this in C#, you can in C++.
If you mean within your app, when your window has the focus, if you create a WinForms app, and then in the designer look at the properties window, there's a lightning flash icon you can click, then you get a list of events you can be notified of in your program. The KeyPress event is called when a key is pressed. You can handle this event, then use MessageBox.Show to show the key that was pressed.
I would recommend buying a good book, such as Inside C# by Tom Archer. A good book is essential when you start, then you can look for help on the web when you have a solid foundation.
Vallari Kamble MSFT
For some great tutorials go here:
http://devforums.amd.com/index.php showtopic=453
Good Luck!
Paul Roberts
lpx
No worries, glad to help :-)
Ofer Rosenberg
That's just turning
MessageBox.Show(e.KeyChar.ToString());
( which was my answer )
into two steps.
I totally recommend buying that book, it will give you a solid foundation and a good reference for use later on.
MarcDeVegas
PedroCGD
MessageBox.Show(e.KeyChar); ( if hte messagebox takes a char, I don't think so ) otherwise MessageBox.Show(e.KeyChar.ToString());
Brad Peterson MSFT
private void e(object sender, KeyPressEventArgs e) { MessageBox.Show(e); }
What I have to do, for make the MessaBox.Show() Method alert that any Key was pressed