I use these codes to inform users when they press a button and show them in a message box that you have pressed a button. In the winform I have a button, so these codes won’t working until I change button1 tabstop to false. and when I click on the button after that it won’t tell users that they’re pressing a button.
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.A)
{
MessageBox.Show("You have pressed A");
}
}
These codes won’t working until I change tabstop of the button to false. Help to how can I do that and let the users know when they pressed a button in any time.
Any help will be appreciated
Set the KeyPreview property of form to true from designer. It will work