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

Application.Run(frmMain)

P: n/a
Whats the purpose of

Application.Run(frmMain) in the Sub Main method.

Why not just...

Dim fMain as New frmMain
frmMain.Show()

???
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"D Witherspoon" <dw**********@noway.org> schrieb:
Whats the purpose of

Application.Run(frmMain) in the Sub Main method.

Why not just...

Dim fMain as New frmMain
frmMain.Show()


Documentation on 'Application.Run':

| Begins running a standard application message loop on the
| current thread.

Showing a form by calling its 'Show' method doesn't do that.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2

P: n/a

"D Witherspoon" wrote:
Whats the purpose of

Application.Run(frmMain) in the Sub Main method.

Why not just...

Dim fMain as New frmMain
frmMain.Show()

???


It's used to set up the main message loop on the current thread. The message
loop is what handles incoming messages from windows (mouse was clicked, mouse
was moved etc) and turns them into events that you can handle.
Without it once the sub main has finished your application exits.

James

Nov 21 '05 #3

P: n/a
Application.Run(), begins running a standard application message loop on the
current thread taking as parameter the form that's going to be the main
entry point of your application. In change, the way you say only creates an
instance of a form, quicky display it and the exits.

Hope this may help you,

Regards,
--
Angel J. Hernández M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda

"D Witherspoon" <dw**********@noway.org> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
Whats the purpose of

Application.Run(frmMain) in the Sub Main method.

Why not just...

Dim fMain as New frmMain
frmMain.Show()

???

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.