VB.NET - Stop multiple RoboHelp windows from opening

Asked By Henry Taylor on 22-Jun-12 10:52 AM
Earn up to 30 extra points for answering this tough question.
This is a vb.net framework 4 vs2010 winform project.

We are using .CHM files for help generated with RoboHelp.

I have a textbox inside another control such as a Tab control and of course the Tab control is on a form.  If I have a HelpContextID for the Textbox it shows the Help correctly.

The help for all the controls on the Tab control are the same so I don't want to have to set the HelpContextID for each control.  Instead I want to set the HelpContextID on the Tab control (Container) then in code if my HelpContextID  = 0 for a control I will access the control Container HelpContextID and use it.

In other words bubble out until I find a HelpContextID > 0 then call ShowHelp().

It works fine but two Help windows open - one with the Help I want and the one with the top most level of help for the application. I am only making the call for ShowHelp() once.

Does any one know why this happens?

Thanks.



[)ia6l0 iii replied to Henry Taylor on 22-Jun-12 11:07 PM
Posting the followup notes posted by the same author on the other thread.

Asked By Henry Taylor in VB.NET on 22-Jun-12 03:39 PM
On further testing I can refine exactly what is happening - sorry I couldn't Edit the previous post.

If I assign a ContextID to a control in a container with the same ContextID  I get two windows with the same Help info.

If I only assign the conatiner the ContextID then I get a Help window with the correct Help info but I then get a second window with the Help root info.

I have enabled stops where the Help calls are made and followed it all the way through to make sure the code isn't some how firing twice and it does not.
[)ia6l0 iii replied to [)ia6l0 iii on 22-Jun-12 11:13 PM
The method stub in which the ShowHelp method is invoked is definetely called twice. You would need to degug and examine the stack trace. And when you are calling the ShowHelp method, ensure that you pass the right contextid. The fallback mechanism for the Showhelp method could be to show the default window. 

Henry Taylor replied to [)ia6l0 iii on 02-Jul-12 04:47 PM
What I described above is not the steps that reproduce this.  Sorry for the confusion.

I have a form with 4 controls on it.  3 are normal combo boxes  - the Help works fine for these.

The 4th control is a user control.  The user control is a simple textbox with code attached that restricts and validates input.

When I put my cursor on one of the combo boxes and hit the F1 key to get Help the help window appears.  If it put the cursor on a different combo box and hit the F1 key the proper Help shows in the same window opened by the first request for help.  This is as expected.

If I then put my cursor on the user control and hit the F1 key a new Help window opens.  Now I have 2 Help windows - NOT what we want.  The help should only ever have 1 window open.

I went through the stack trace and it is 
Definitely NOT getting called twice.  In fact for this control if I put a break on the call to Help.ShowHelp() and then skip 1 Help window still shows!  I cannot find how it is doing it.  It is maddening.