Deriving Form Events

  • Thread starter Thread starter Ryan Wade
  • Start date Start date
R

Ryan Wade

I want to create a base form to derive all my forms from. In the base for I
want a KeyPress event to fire that when the enter key is pressed it acts
like the tab key and moves to the next control. How would I set this up in
my base form and how would I set it ip in forms that derive from it.
Samples would be great. Thanks

Ryan
 
Ryan,

You would have to set the KeyPreview property to true. Then, you would
override the OnKeyDown and OnKeyUp methods to handle when the enter key was
pressed, and move the tab focus to the next control.

Hope this helps.
 
So if I drive a form from another, the events don't automatically go the the
derived form? You have to overide them?

Thanks

Ryan

Nicholas Paldino said:
Ryan,

You would have to set the KeyPreview property to true. Then, you would
override the OnKeyDown and OnKeyUp methods to handle when the enter key was
pressed, and move the tab focus to the next control.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ryan Wade said:
I want to create a base form to derive all my forms from. In the base
for
I
want a KeyPress event to fire that when the enter key is pressed it acts
like the tab key and moves to the next control. How would I set this up in
my base form and how would I set it ip in forms that derive from it.
Samples would be great. Thanks

Ryan
 
Back
Top