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

Application.Run - message loop

P: n/a
Can someone explain the difference between starting an application using
Application.Run() and using ShowDialog?

Module MainModule
Sub Main
Dim f1 as New Form1
Application.Run(f1)
End Sub
End Module

vs.

Module MainModule
Sub Main
Dim f1 as New Form1
f1.ShowDialog()
End Sub
End Module

Also if someone can explain or point me to a good place that explains what
exactly a Message Loop is, that would be helpful. None of my books talk
anything about this stuff.

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
"Mark Denardo" <ma*********@runbox.com> schrieb
Can someone explain the difference between starting an application
using Application.Run() and using ShowDialog?

Module MainModule
Sub Main
Dim f1 as New Form1
Application.Run(f1)
End Sub
End Module

vs.

Module MainModule
Sub Main
Dim f1 as New Form1
f1.ShowDialog()
End Sub
End Module
Application.Run internally calls f1.Show first.
- Using Showdialog, it automatically returns as soon as you set the Form's
DialogResult property.
- Using Showdialog, the Form is not disposed automatically. You'd have to
call f1.Dispose additionally.
- Using Showdialog, clicking the "X" does not mean that the Form is closed,
it's only hidden and can be reshown by calling ShowDialog again. Using
Application.Run, you'd have to create a new instance to show.

All information available via <F1>.
Also if someone can explain or point me to a good place that
explains what exactly a Message Loop is, that would be helpful. None of my
books talk anything about this stuff.

http://msdn.microsoft.com/library/en...sagequeues.asp

Especially about message loops (look for headline "Message Handling"):
http://msdn.microsoft.com/library/de...sagequeues.asp

Armin

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.