Sheritlw
asked on
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
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.ActiveMdiC hild;
String cfName = currentForm.Name;
this.helpProvider1.SetHelp Navigator( this.btnHe lp, System.Windows.Forms.HelpN avigator.T opicId);
{
if (cfname = "AddEmpForm")
this.helpProvider1.SetHelp String(thi s, "html\\1150.htm");
}
//write here code
//to go to design mode from Code press Shift+F7.
}
Below is what I have
private void btnHelp_Click(object sender, EventArgs e)
{
Form currentForm = Form.ActiveForm.ActiveMdiC
String cfName = currentForm.Name;
this.helpProvider1.SetHelp
{
if (cfname = "AddEmpForm")
this.helpProvider1.SetHelp
}
//write here code
//to go to design mode from Code press Shift+F7.
}
ASKER
The error was because cfname is case sensative (should have been cfName) and needed ==
http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.activeform.aspx