Keypress or Keydown Event in mdiForm

Nov 23 2010 3:59 AM

hey coders...i create some children forms in my main form..it is ok till here..my problem is that i cant catch which button is pressed when the second form is opened..in first child form it works well but not in second or in another child forms..i set True my Form2's KeyPreview property...by the way i open my mdiChild forms as tabpaged.. 
here my codes
private
void Form2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W)
MessageBox.Show("W tusuna basildi");
}
and i wrote it in KeyPress even too
private void Form2_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 'k')
MessageBox.Show("Tusa basildi");
}
 so what can i do else or where is my mistake ?

Answers (1)