Thank you so much for that sir.. It works.. Sir, how can i can assign a hotkey to a Button?.. Ahm, for example.. I want a Button_Click event to be associated with a shortcut key.. Instead of me Pressing the Button itself, i just have to press a key from the keyboard.. like; Pressing the F2 key to be associated with
the Event of a Click of a Button.. Im really sorry for this sir.. I ask a lot of questions. I'm just new to C#, and I'm only a student.
for printable characters (letters, digits, punctuation) you should use the KeyPress event;
its event arg provides a KeyChar property which is a char, so don't compare it to
(char)Keys.A instead compare it to 'a' or 'A'.
special characters (escape, enter, ...) don't fire the KeyPress event; you should use
the KeyDown (possibly KeyUp) event for these; its event arg provides a KeyCode property
which is a Keys, so that one you can compare to Keys.Escape and others.
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
I have a project developed in 2.0 Framework, can i use a Forum which is developed in 1.1 Framework.
Can you use source code from a .NET 1.1 project? Sure. Most of the .NET 2.0 BCL is backwards compatible, but there are breaking changes.
Can you use a .NET 1.1 compiled assembly in your .NET 2.0 project?? Most likely not, but only if the .NET 1.1 assembly MUST use the .NET 1.1 CLR. If this is the case, then no, you can't use the assembly because you cannot load two different versions of the .NET CLR into the same process.
If the .NET 1.1 assembly will work fine running under the .NET 2.0 CLR, then yes, you can use it.
But, like I said, there ARE breaking changes between .NET 1.1 and .NET 2.0 and above.
It's not in my articles, it's just a signature. Form class has a KeyDown event which receives KeyEventArgs type parameter. You can check its Control property to determine if CTRL is down or modifiers property and also examine the KeyData property.
Keydown is fired twice: once for control key and once for Enter so you can't test it in one piece of code. Instead use keydown and keyup events to toggle a boolean value which shows if CTRL key is down and for enter key and this value