Question:
I have a form with two buttons called aButton and bButton. I want the function myFunctionMouseClickA to be executed by clicking on aButton, and by clicking on bButton to execute the function myFun2. In this case, if (including right after clicking on aButton) the enter is pressed, the myFunctionEnterPressed function should be executed. How can you do this?
That is, as I understand it, I need to ensure that after clicking on aButton, the function myFunctionMouseClickA is triggered (for this, I will associate it with the mouseClick event), and after that bButton is in focus. The latter is what is difficult for me.
Answer:
May I help
this.ActiveControl = null;
But the better option suggested in the comment by Alexander Petrov:
Use the Focus method. In the click handler, write:
bButton.Focus();