PC Review


Reply
Thread Tools Rate Thread

app ends after sub main()

 
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      25th Jul 2005
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.
 
Reply With Quote
 
 
 
 
AlexS
Guest
Posts: n/a
 
      26th Jul 2005
Do you have Application.Run call in your main?

HTH
Alex
"Ben" <(E-Mail Removed)> wrote in message
news:2A3E4DA0-B51A-4950-80F2-(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      26th Jul 2005
"Ben" <(E-Mail Removed)> 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/>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      26th Jul 2005
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


 
Reply With Quote
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      26th Jul 2005
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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing WINWORD.EXE from Excel VBA when my main proc ends =?Utf-8?B?RWRtdW5k?= Microsoft Excel Programming 2 22nd Aug 2007 04:09 AM
filter using "ends with" and 3 choices? Ex: ends with 1,2 or3 =?Utf-8?B?RGViYmll?= Microsoft Excel Worksheet Functions 1 6th Apr 2007 01:07 AM
Sub Main Ends so does the application rrowe Microsoft VB .NET 6 25th Jul 2006 03:25 PM
KeyUp in response to MessageBox ends up in main form Houston Keach Microsoft Dot NET Compact Framework 2 5th Nov 2003 10:35 PM
Compacting front ends and back ends Deb Struble Microsoft Access Database Table Design 2 15th Sep 2003 07:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:33 PM.