Like many other developers, I have created a user control to be a command button. Yes, it's because of that whole look-and-feel thing.
Has anyone figured out how to implement the "Default Button" behavior that the system command button allows?
I know I can get the "KeyDown", but isn't that specific to the object that currently has focus? Is there a better/easier way?
Mark Hulser
Mark
You've already noted how to do this. In the KEYDOWN event of the object capture the ENTER key and invoke the desired event or function.
Now if you want to do this more globally. or if you have multiple objects each with their own default key, put code in the KEYDOWN event of the WINDOW. When it is triggered, check the object that has focus and invoke the appropriate object.event_or_function.
Olan