Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modal/Non Modal Forms 5

Status
Not open for further replies.

ecannizzo

Programmer
Sep 19, 2000
213
US
When I run my code from VB I don't get this problem, but when I try to run the .exe I get an error that says "Can't show non modal form when modal form is displayed". I don't have anything set to non modal or modal. Can anyone help me?

Thanks!
 
Check all your .Show commands. If any one of them has a .show 1 then you are displying a form modally i.e. execution stops until the displayed form is hidden. Specifically the error occurs when a form which has been displayed modally tries to load or Show a non-modal form (default). If that is not your problem then search MSDN.
 
I don't have any .show 1, in my code. Hmm. Thanks for trying.
 
A messagebox is modal, Are you somehow trying to display a form or anything after you have displayed a message box?
 
A MSGOX can not cause the problem unless MSGBOX itself tries to display a non-modal form. Execution of your program is stopped until the MSGBOX, being modal, goes away so SHOW ing a modal form yourself can't cause a problem unles YOU are in a modal form.
 
I am using the webbrowser control. Can that have something to do with it?
 
I think you may be trying to show a form in a webbrowser event (or a routine that is called from the event). These events can be triggered even if a modal form is displayed.
 
If u want to show an modal form use
FormName.Show vbModal '1

If u want to show an nonmodal form use
FormName.Show vbModeless'0

Hope this helps
________

George
 
Try this: Add the API OutputDebugString, then download the debugviewer from recompile the program, and run it again. OutputDebugString is like debug.print, except it works in .EXE's, so it's useful for tracking errors of this nature.

the declaration in a .BAS module is this:

Public Declare Sub OutputDebugString lib "kernel32" Alias "OutputDebugStringA" (byval lpszDebugString as String)

and the syntax is this:
OutputDebugString "This is a debug string"

Add those to where you think the problem might be, recompile, and watch the output. When you get the error, check for the last line sent to debugview, and work from there.

Kevin
 
hmm that sounds preety weird to me.
Can you find out on your code where it's breaking? And maybe post here the part of that code so we can have a look at it.
Something must be wrong with it I think. The obvious answer to your problem would be a modal form that wasn't being hidden/closed trying to load another form, but you said thats not your case. So maybe if we could have a look at that part of the code we could find out something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top