Determining if a form is the "active" form?

Hi all,

I have an event handler in my main form which is sometimes called even while another form is shown modally (using ShowDialog).

If the main form is not the currently "active" form, I don't want to perform certain actions (changing focused control etc) in this event handler.

Is there a way of telling whether there's another form currently being shown modally in my application

Cheers,
Matt


Answer this question

Determining if a form is the "active" form?

  • malik anees

    Got it:

    if (this.ActiveForm == this) ...

    *PWOP* Tongue Tied

  • Determining if a form is the "active" form?