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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-Time Error 401 - Non Modal Form..

Status
Not open for further replies.

basepointdesignz

Programmer
Jul 23, 2002
566
GB
Hi peeps,

Even though I've already done a search on this subject and found a load of info on it, I thought I'd start a thread about it because my problem is a bit different from what I read about..

On my app's splash screen, I have a previous instance check, which if the program is already running and someone tries to run another one, it'll detect the second version and display a msgbox before stopping the second program in it's tracks.

When this happens the msgbox appears and the program unloads but I get a run-time error, which doesn't look too professional..

Run-Time Error: '401'
Can't show non-modal form when modal form is displayed.


How do I get around this? Should I hide the splash screen before the msgbox appears, thus causing the splash screen to lose focus - or does it get a bit more complicated than this?

Can anyone help?

Thanks,

Renegade..

 
Think there had to be some code to really help...
But there is not a problem with the messagebox but with the splash-screen. I could imagine that your problem would rise if you have a timer on your splash-screen that waits some time till it shows up the main form. And in there I would look for the bug. There's an error in the logic of the handling. Perhaps you try to show the mainform allthough the program is going to stop execution.

Andreas
 
Thanks Andreas,

Actually I do have a timer on the splash screen. I'd would probably have to stop the timer if another instance of the program was found - if not, like you said, I'd have to wait until the mainform was loaded before I show the msgbox and stop the program.

Thanks again,

Renegade..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top