Did you try setting the Form's KeyPreview property to True? I would expect a well-behaved UserControl to handle the ParentChanged event.
On Tue, Mar 15, 2011 at 5:22 PM, Michael Ridland <[email protected]> wrote: > Hi > > I need to catch a Control-Enter keyboard input on a UserControl and any of > it's children, but it seems only the actual focused control gets the events. > So I looked around the net and didn't find a solution. I came up with my own > solution, which involved cycling through all the children and attaching a > KeyDown event. > > > public void Init() > { > RecursivelyAddEvent(this.Controls, 0); > } > > public void RecursivelyAddEvent(ControlCollection controls, int level) > { > foreach(Control ctrl in controls) > { > ctrl.KeyDown += EmailEditor_KeyDown; > if(level < 3) > RecursivelyAddEvent(ctrl.Controls, level+1); > } > } > > It works, but there must be a better solution? > > Thanks > Noobie Winforms Dude > > > > > >
