batel hodefi

batel hodefi

  • NA
  • 16
  • 0

KeyPress event with controls in Windows

Dec 5 2009 5:51 PM
I created a Form and put some controls in it like: button, textBox. I tried to connect all the controls to KeyPressEvent, but when it's run the count of the collection is 0. I don't understand why? my code: public Form1() { InitializeComponent(); ControlCollection C = new ControlCollection(this); for (int i = 0; i < C.Count; i++) { C[i].KeyPress += new KeyPressEventHandler(funcionName); } }

Answers (15)