Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

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*
Posted

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.

Posted

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?

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*
Posted

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.

Posted

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)

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

Posted

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

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...