I don't understand the purpose of this. However, it is possible to do so.
Please follow the steps,
Step 1)
You will need to handle the Keypress event in form level. See below code
public partial class Form1 : Form
{
private bool YKeyEntered = false;
public Form1()
{
InitializeComponent();
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (YKeyEntered)
{
chkInternal.Checked = true;
}
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Y)
{
YKeyEntered = true;
}
}
}
Step 2
By default Form cannot read a key. Set the 'KeyPreview' property of the form to 'true', so that keyboard messages are received by the form before they reach any controls on the form.
In this code, If the Key 'Y' is pressed when the form is active, the chechbox named 'chkInternal' get checked.
Please go through these links,
http://msdn.microsoft.com/en-us/library/ms171538.aspx[
^]
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress.aspx[
^]
If this solutions helps you please mark as solved. Let me know if you still got questions regarding this.