How to get the currently active (focused) form in my application?
You can get a reference to the currently active form by using the static Form. ActiveForm property. Edit: If no Form has the focus, Form. ActiveForm will return null .
Procedure. Right-click an empty cell, click Active Form, then click Insert Active Form. The Insert Active Form dialog box opens. Enter a name for the form in the Active Form Name box.
Form fc = Application. OpenForms["UpdateWindow"]; if (fc != null) fc. Close(); fm.
Screen.ActiveForm
does the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With