You could do it on a key event for the form, if you set the form.KeyPreview
to true. Or you could override the ProcessCmdKey() for the form. However,
it's not hard to have each control handle the KeyDown. You could call a
method in the Load() event of your form to attach them all. Something like:
void AttachKeyDownToControls(ControlCollection ccoll)
{
foreach ( Control c in ccoll.Controls )
{
if ( c.Controls != null )
{
AttachKeyDownToControls( c.Controls )
}
else
{
c.KeyDown += <whatever it is you do when you attach a KeyDown
event>;
}
}
}
This sort of thing works well if you only want to attach them to a certain
type of control. In the "else", you might really say
else if ( c is TextBoxBase && !c.Multiline )
// not sure if TextBoxBase really has multiline property but you get the
idea)
c.KeyDown += ...
"Keith Smith" <ke*********@verizon.net> wrote in message
news:u1jXd.29279$uc.19146@trnddc09...
Is there an easy way to make the {Enter} key take the cursor to the next
control without using a KeyDown event on each control?