Keeping a separate modeless form usable while modal dialog box is being shown

devj

New member
Joined
Feb 27, 2008
Messages
4
Programming Experience
10+
Hi

I'm trying to use a separate form with a webbrowser control on it to show context-sensitive help for my application (don't ask why I don't use the Help class). Let's call this form HelpBrowser. When the user requests help for the first time, HelpBrowser is created from the main thread and shown using HelpBrowser.Show() as I want it modeless.

This all works fine except for this; if the HelpBrowser is already open and the user opens a dialog box (modal form) from the main form, HelpBrowser can not be accessed by user anymore as long as the dialog box is open (it can not be moved, resized, scrolled, etc. anymore but it still shows new help if user requests it). I guess this is because the modal dialog box freezes all other open forms while it is open. However, if HelpBrowser is opened for the first time from a dialog box everything works fine.

Is there a way to keep control of the HelpBrowser form at all times even when a dialog box is opened from the main form, while still keeping everything in one process? Passing the main form as an argument when calling Show doesn't make any difference.

Thanks
 
I would show the HelpBrowser from a separate thread, you can use a Background Worker for this.

In the DoWork event, use this statement: Application.Run(New HelpBrowser)
 
Thanks, I tried this, but I get

"ThreadStateException was unhandled by user code:
ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."

How do I set a BackgroundWorker to use STA?
 
Back
Top