app ends after sub main()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

could someone please suggest to me another way to work around sub main? I am
currently migrating 6.0 codes over to .net. as soon as sub main() ran, vb
ends the application immediately. So I moved my codes to over to my splash
screen form. Made my project preference to run from splash screen as start
up. after the splash screen is shown, I ordered it to show my next screen by
calling to a new instance of that new screen. However, no matter what I do,
my program failed to display my next screen. My application keeps ending
itself.

Is there another way to work around these issues? Thanks.
 
Ben said:
could someone please suggest to me another way to work around sub main? I
am
currently migrating 6.0 codes over to .net. as soon as sub main() ran, vb
ends the application immediately. So I moved my codes to over to my
splash
screen form. Made my project preference to run from splash screen as
start
up. after the splash screen is shown, I ordered it to show my next screen
by
calling to a new instance of that new screen. However, no matter what I
do,
my program failed to display my next screen. My application keeps ending
itself.

\\\
Public Module Program
Private m_Context As ApplicationContext

Public Sub Main()
Context = New ApplicationContext()
Context.MainForm = New SplashForm()
Application.Run(Context)
End Sub

Public Property Context() As ApplicationContext
Get
Return m_Context
End Get
Set(ByVal Value As ApplicationContext)
m_Context = Value
End Set
End Property
End Module

Public Class SplashForm
Inherits Form

Private WithEvents m_CloseTimer As New Timer()

Public Sub New()
Me.Text = "Spash form"
End Sub

Private Sub Form_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles MyBase.Load
m_CloseTimer.Interval = 1000
m_CloseTimer.Enabled = True
End Sub

Private Sub m_CloseTimer_Tick( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles m_CloseTimer.Tick
m_CloseTimer.Enabled = False
Program.Context.MainForm = New MainForm()
Me.Close()
Program.Context.MainForm.Show()
End SUb
End Class

Public Class MainForm
Inherits Form

Public Sub New()
Me.Text = "Main form"
End Sub
End Class
///
 
Ben,

As alternative for the method showed by Herfried.

Instead of making your splash form your mainform, I use always one mainform,
that one starts by instance in the load event my splash screen as
\\\
dim splash as new splashform
splash.show
....do actions eventualy with a threading.thread.sleep(x)
splash.close
///

In the VBNet form class is build in (as it was in VB6) an automatic sub main

You can set that mainform in your application properties with setting the
startup object

I hope this helps,

Cor
 
Back
Top