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

Application.Run or not?

P: n/a
Hi.

Is there any benefits of using Application.Run in a Sub Main procedure to
start a windows application? I set a form as the startup object for all my
vb programs, but have seen several examples that starts an application by
using Application.Run in a Sub Main instead of define a form as the startup
object.

TIA,
Erik Cruz
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Erik Cruz" <er******************@antares.com.br> schrieb
Is there any benefits of using Application.Run in a Sub Main
procedure to start a windows application? I set a form as the startup
object for all my vb programs, but have seen several examples that
starts an application by using Application.Run in a Sub Main instead
of define a form as the startup object.


Whenever you set a form as the startup object, VB.NET creates an invisible
Sub Main that looks like this one:

shared sub main
application.run(new Form1())
end sub

Application.Run contains a message loop that processes the messages sent to
the application. This default Sub Main can be used if there is no code to be
executed before or after showing the main form, and if the Form is displayed
from the start til the end of the application.
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #2

P: n/a
* "Erik Cruz" <er******************@antares.com.br> scripsit:
Is there any benefits of using Application.Run in a Sub Main procedure to
start a windows application? I set a form as the startup object for all my
vb programs, but have seen several examples that starts an application by
using Application.Run in a Sub Main instead of define a form as the startup
object.


In addition to Armin's reply, have a look at the IL code of both
applications using "ildasm.exe".

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.