By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,688 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,688 IT Pros & Developers. It's quick & easy.

app ends after sub main()

P: n/a
Ben
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.
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
Do you have Application.Run call in your main?

HTH
Alex
"Ben" <Be*@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
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.

Nov 21 '05 #2

P: n/a
"Ben" <Be*@discussions.microsoft.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
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
Nov 21 '05 #4

P: n/a
Ben
Thanks a lot for the helps guys, I got it works.

"Cor Ligthert [MVP]" wrote:
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

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.