c# - Form1_KeyDown NOT WORKING -


private void form1_keydown(object sender, keyeventargs e) {     if (listbox1.items.contains(e.keycode))     {         listbox1.items.remove(e.keycode);         listbox1.refresh();         timer1.interval -= 10;         difficultyprogessbar.value = 800 - timer1.interval;         stats.update(true);     }     else     {         stats.update(false);     }      correctlabel.text = stats.correct.tostring();     missedlabel.text = stats.missed.tostring();     totallabel.text = stats.total.tostring();     accuracylabel.text = stats.accuracy.tostring();  }  private void timer1_tick(object sender, eventargs e) {     //add random key listbox     listbox1.items.add((keys)random.next(65, 90));     application.doevents();     if (listbox1.items.count > 7)     {         listbox1.items.clear();         listbox1.items.add("game over");         timer1.stop();     } } 

when run application, timer1_tick event working fine, form1_keydown event doesn't execute when press key. missing? why key_down event never fires? thanks

keydown fires in control focus.
receive @ form level need set property. keypreview=true form


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -