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

Messagebox - Forms dissapear

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
During design, when the application is running, if I open a messagebox my form dissapears leaving my screen empty other than seeing the code windows behind. On answering the messagebox okay, the form still remains hidden. Any ideas, its driving me up the wall as I cannot continue to see the programme running. Thanks
 

For now try putting a me.setfocus after the msgbox. Its just temporary because I belive that once it is an exe the problem should go away (most of the time).

Good Luck

 
Thanks folks.
Vb5prgrmr, I tried it out. The mainform does re-appear when the messagebox closes, but it leaves a hole in the form where the message box was. Also it would be good if the mainform stayed around when the messagebox appears. Thanks

Clintonwhite, thanks. However my mainform is a startup form, I cannot see anything other than MDI reference in the properties. I have tried Form1.Show VbModal in the form load, but does not like it. I even tried adding another form as a startup, with Form1.Show VbModal. Thanks
 

Ok then it sounds like you have some other processing going on so do the me.setfocus and either the refresh or doevents after.

Good Luck

 
As vb5prgrmr pointed out, you probably have another process running with a loop? of some kind. Try putting [blue]DoEvents[/blue] inside your loop somewhere.
 

Also after rereading your last post I take it that this is a splash form. You may want to try the following sequence of events instead...

Load Main Program Window (window that is visible in task bar)
Then load splash form
and then do your initialization of the program (if any) i.e.
[tt]
Sub Main()
Form1.Show
SplashForm.Show
'call initialization routines (even if they are in main form)
Call Form1.MyInitializationRoutines
Unload SplashForm
[/tt]

In Form1
[tt]
Private Sub Form_Load()
End Sub

Public Sub MyInitializationRoutines()
'do stuff here
End Sub
[/tt]

Then the final action would be to unload the splash form (see above)

Good Luck

 
Thanks for the attempts to sort me out, however I am going to use a form as a messagebox for now. I cannot locate or see where any other activity is going on to upset the focus aspects. I removed 2 timers even though they were not enabled, I removed form skinner controls, but to no avail. Basically I have a mainform which appears blank, but has a second form open on top. The second form is smaller than the mainform. This second form has controls on it to accept user procedure requests. When they complete their request, form 1 unloads and the mainform opens up facilities they have asked for. Its during this that a message box appears to ask confirmation of something they want to save or not. Its here the mainform dissapears when the messagebox is displayed. As VB5prgrmr said, it will possible sort itself out when its an exec, but its a pain in design. I did a quick test on a new project with similar forms but only having a messagebox called, and that worked okay, so obviously something is going on behind the scenes. Because of time, I will use a form for now and get a chance sometime later to try and find out what the problem is. Hope you all don't think I'm a time waster on this one, and many thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top