473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Keeping application alive starting from Sub Main()

Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance
Nov 20 '05 #1
22 2079
Hi,
You could create a blank project and put a Sub Main() in it, this
would be the default startpoint. However, it is unlikely you would want to
do it this way really, you should try and think VB.NET rather than the old
way. For example, create a windows forms application in VB>NET and you will
find that your primary form ( Form1 ) is the startup class. when you run it
the form will appear.

regards - OHM

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

Nov 20 '05 #2
Hi,
You could create a blank project and put a Sub Main() in it, this
would be the default startpoint. However, it is unlikely you would want to
do it this way really, you should try and think VB.NET rather than the old
way. For example, create a windows forms application in VB>NET and you will
find that your primary form ( Form1 ) is the startup class. when you run it
the form will appear.

regards - OHM

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

Nov 20 '05 #3
Hi Vell,

If you are starting a form from Sub Main, you need to run it using
Application.Run so that a message loop is started and the application
doesn't terminate until the form is unloaded...

\\\
Public Sub Main()
Application.Run(New MyForm)
End Sub
///

Hope this helps,
Gary

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

Nov 20 '05 #4
Hi Vell,

If you are starting a form from Sub Main, you need to run it using
Application.Run so that a message loop is started and the application
doesn't terminate until the form is unloaded...

\\\
Public Sub Main()
Application.Run(New MyForm)
End Sub
///

Hope this helps,
Gary

"Vell" <an*******@discussions.microsoft.com> wrote in message
news:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

Nov 20 '05 #5
Cor
Hi OHM,

My kind of style, I love you.
Nice to see those rows with people I did see so much last month

:-)

Cor
Nov 20 '05 #6
Cor
Hi OHM,

My kind of style, I love you.
Nice to see those rows with people I did see so much last month

:-)

Cor
Nov 20 '05 #7
Hi again,

thank you all...

Gary your tip works fine...

bye

-----Original Message-----
Hi Vell,

If you are starting a form from Sub Main, you need to run it usingApplication.Run so that a message loop is started and the applicationdoesn't terminate until the form is unloaded...

\\\
Public Sub Main()
Application.Run(New MyForm)
End Sub
///

Hope this helps,
Gary

"Vell" <an*******@discussions.microsoft.com> wrote in messagenews:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting first troubles..

in vb6 i can start an application from Sub Main() and load for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

.

Nov 20 '05 #8
Hi again,

thank you all...

Gary your tip works fine...

bye

-----Original Message-----
Hi Vell,

If you are starting a form from Sub Main, you need to run it usingApplication.Run so that a message loop is started and the applicationdoesn't terminate until the form is unloaded...

\\\
Public Sub Main()
Application.Run(New MyForm)
End Sub
///

Hope this helps,
Gary

"Vell" <an*******@discussions.microsoft.com> wrote in messagenews:17*****************************@phx.gbl...
Hi,
i'm moving my first steps in vb.NET world and i'm getting first troubles..

in vb6 i can start an application from Sub Main() and load for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?

Can anyone help me?
Thanks in advance

.

Nov 20 '05 #9
Well Cor, I really dont think saying "I Love you" was what you really meant,
at least I hope not. ! and that we are dealing with a language issue here !

I think what you meant to say was 'you like the way I answered the
question'.

Regards - OHM

"Cor" <no*@non.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Hi OHM,

My kind of style, I love you.
Nice to see those rows with people I did see so much last month

:-)

Cor

Nov 20 '05 #10
Well Cor, I really dont think saying "I Love you" was what you really meant,
at least I hope not. ! and that we are dealing with a language issue here !

I think what you meant to say was 'you like the way I answered the
question'.

Regards - OHM

"Cor" <no*@non.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Hi OHM,

My kind of style, I love you.
Nice to see those rows with people I did see so much last month

:-)

Cor

Nov 20 '05 #11
Cor
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor
Nov 20 '05 #12
Cor
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor
Nov 20 '05 #13
Thank God For That !

"Cor" <no*@non.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor

Nov 20 '05 #14
Thank God For That !

"Cor" <no*@non.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor

Nov 20 '05 #15
Cor,
Are you Male?
"Cor" <no*@non.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor

Nov 20 '05 #16
Cor,
Are you Male?
"Cor" <no*@non.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
OHM,

No not real the language question, was just for fun to overdo it.

:-))

Cor

Nov 20 '05 #17
Cor
> Cor,
Are you Male?


LOL
Nov 20 '05 #18
Cor
> Cor,
Are you Male?


LOL
Nov 20 '05 #19
I'll take that as a yes then !
"Cor" <no*@non.com> wrote in message
news:ef**************@TK2MSFTNGP10.phx.gbl...
Cor,
Are you Male?


LOL

Nov 20 '05 #20
I'll take that as a yes then !
"Cor" <no*@non.com> wrote in message
news:ef**************@TK2MSFTNGP10.phx.gbl...
Cor,
Are you Male?


LOL

Nov 20 '05 #21
"Vell" <an*******@discussions.microsoft.com> schrieb
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?


Declaring it in a Module is no problem.
Shortest version:
sub main
application.run(new form1)
end sub

Or:
sub main
dim f as new form1
application.run(f)
end sub
Application.run starts the message loop that processes the windows messages
and keeps your application alive. It exits as soon as the passed form has
been closed. Application.run also shows the form first, so you don't have to
do it.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #22
"Vell" <an*******@discussions.microsoft.com> schrieb
Hi,
i'm moving my first steps in vb.NET world and i'm getting
first troubles..

in vb6 i can start an application from Sub Main() and load
for example a form using 'set' and 'show' command. The
output for the user will be the form and the program will
still run.

In vb .NET, if i made it in the same way, will be no
output for the user because the program terminate when the
execution reach the End Sub statement of the Sub Main().

I think this happens because the form is declared in
Module. There's a way to do so?


Declaring it in a Module is no problem.
Shortest version:
sub main
application.run(new form1)
end sub

Or:
sub main
dim f as new form1
application.run(f)
end sub
Application.run starts the message loop that processes the windows messages
and keeps your application alive. It exits as soon as the passed form has
been closed. Application.run also shows the form first, so you don't have to
do it.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
0
by: John | last post by:
Hi I am using the Internet Transfer Control as follows; strData = "Some data" strHeaders = "Content-Type: application/x-www-form-urlencoded" & vbCrLf objInet.Execute strURL, "POST",...
0
by: John | last post by:
Hi I am trying to use the internet transfer control to send some data to a site. I want my MS ISA proxy server to keep the connection alive. What syntax should I use to send the 'keep alive'...
3
by: stumorgan | last post by:
There is probably an extremely simple answer to this question and I'm just being foolish. I have a main form (let's say FormMain) which opens other forms (let's say Form1, Form2). How do I keep...
11
by: Vell | last post by:
Hi, i'm moving my first steps in vb.NET world and i'm getting first troubles.. in vb6 i can start an application from Sub Main() and load for example a form using 'set' and 'show' command. The...
1
by: Jason James | last post by:
Hi All, I have created a class that references MS Word. The class will happily control Word, adding text, etc. However, when I have finished with the VB app I want to close the app, but not...
2
by: Mark Huebner | last post by:
I am trying to create a web application with Visual Studio 2005 and C# that will start up a "keep alive" application on my web site's server. My DotNetNuke home page loads slowly when the site...
1
by: t.mitchell | last post by:
Hi, I have a python gtk app that allows users to have one project open at a time. I have recently discovered that projects are not being freed when they are closed - the refcount is not hitting...
1
by: ThomMCann | last post by:
I have a problem with keeping a page alive while the server is writing large xml files to Oracle. The server time out is set to 15 minutes. I need a programmatic way to keep the jsp connection...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.