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

Problem with form instantiation

Status
Not open for further replies.

Custom24

Programmer
Joined
Nov 27, 2001
Messages
591
Location
GB
Hi
My app writes to a db on startup, so I present the user a splash while it is doing this.
I use a sub main in a module as the startup object and then show the splash (frmSplash,show), do my stuff, hide the splash and set it to nothing, and then instantiate the main form like this

dim frmMain as new frmMain
frmMain.ShowDialog

The problem is that some of the time this works fine and some of the time the app just closes. A breakpoint on the next line is hit, and I can set next statement back to frmMain.ShowDialog, but this is no good when the app is built. Some of the time, the app works fine and some of the time it just shuts down.

The shutdown routine works correctly.

Has anyone else encountered this problem. I suppose I could just use frmMain as the startup object, but I don't like doing it this way.

Thanks in advance
Mark
 
VB.Net quits when the Startup Form closes or the Main subroutine ends. I use my main form as the startup for the project, display the splash form which has a timer and use Application.Run to run the main form. The timer on the splash closes the form after so many seconds.

Dim objfrmLogo As New frmLogo()
objfrmLogo.Display()
objfrmLogo = Nothing ' Splash still showing for awhile
Application.Run(New frmCompare()) Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Thanks guys - Application.Run seemed to sovle the problem
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top