ThePentiumGuy Posted September 21, 2003 Posted September 21, 2003 hey, i have a "splash screen" for my app and i wanted to make it so that after the splash screen, the main form opens up.. i did that - but how would i make it so that the main form .. closes you see - the main form closes(when i hit X).. but not the application, its still running in the background i think the term for it is modal.. i cant seem to make the main form.. modal Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted September 21, 2003 *Experts* Posted September 21, 2003 If you want to make the form show modal use the .ShowDialog() method instead of Show(). Quote
*Experts* Volte Posted September 21, 2003 *Experts* Posted September 21, 2003 What you most likely want to do it make your startup object Sub Main, and in the Sub Main (declare it Shared inside a class) show the splash screen manually, and then the main form. When you wish the program to exit, use Application.Exit but make sure you have cleaned up all your resources properly first. Quote
ThePentiumGuy Posted September 21, 2003 Author Posted September 21, 2003 mutant - your method somehow doesnt work.. it gives an error then closes here's my code Public Class splash Inherits System.Windows.Forms.Form Dim X As Integer Dim frmMain As New Main() "designer code" Private Sub tmrSpl_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSpl.Tick X = X + 1 If X = 5 Then frmMain.ShowDialog() splash.ActiveForm.Close() tmrSpl.Enabled = False End If End Sub End Class Splash is my splashscreen - but the prob is, i cant "close" the splash - its in the way - if i say this: frmMain.ShowDialog() splash.ActiveForm.Hide() tmrSpl.Enabled = False then it "closes(actually it hides) but the main form isnt modal.. when i close it, its still "running" VF - im sorry, but i dont know what you mean.. can someone help me out? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
*Experts* mutant Posted September 21, 2003 *Experts* Posted September 21, 2003 The easiest way to do this would be to start two message loops: Public Shared Sub Main() Application.Run(New SplashForm) Application.Run(New MainForm) End Sub Now when you exit the splash form when the timer reaches the specified number and you exit the spalsh, the main form will show. Quote
ThePentiumGuy Posted September 22, 2003 Author Posted September 22, 2003 hmm - do i have to set the form startup to Sub Main? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted September 26, 2003 Author Posted September 26, 2003 when i do this, after i close the application, both forms pop up again.. then closes... (should i attach the project - im sorry im just not following what you are saying) Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
techmanbd Posted September 26, 2003 Posted September 26, 2003 Here is what I did, because I was having the sme problem. set the main form as the start up. private Public FrmMAin_Load ..... dim frmSplash as new frmSplash me.hide frmSplash.show end sub and in the splash form where ever you want the splash to end and goto the main form private sub "whatever" dim frmMain as new frmMain frmMain.show me.close end sub Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.