Determine which form has focus

Hi,
I am trying to implement .chm contextid help in my application and need to test what form currently has focus.
How do I determine which form, in a MDI application, has focus?
thanks
SheritlwAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
SheritlwAuthor Commented:
Yes, I already saw that article in my search.  However, it does not tell me how to use it to determine which form has focus.

For example,

Form currentForm = Form.ActiveForm;

If currentform = myformname then I want to show my help

I am very new to C# and am just trying to implement help within a MDI application by determining which form has the focus.  

Please provide an example.
Thank you
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Form currentForm = Form.ActiveForm;
String cfName = currentForm.Name;

if (cfName = "your form name")
{
   // show help ...
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SheritlwAuthor Commented:
I receive an error that  project.AddEmpForm is a type but used like a variable
Below is what I have
private void btnHelp_Click(object sender, EventArgs e)
     
    {
      Form currentForm = Form.ActiveForm.ActiveMdiChild;
      String cfName = currentForm.Name;

      this.helpProvider1.SetHelpNavigator(this.btnHelp, System.Windows.Forms.HelpNavigator.TopicId);

     
      {
        if (cfname = "AddEmpForm")
          this.helpProvider1.SetHelpString(this, "html\\1150.htm");
      }
      //write here code
      //to go to design mode from Code press Shift+F7.
    }
0
SheritlwAuthor Commented:
The error was because cfname is case sensative (should have been cfName) and needed ==
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.