What is differ between Application.Run and .ShowDialog() ?

A

alex9128

Hi All,

I mean if you writing Sub Main in VB you can start you application either
way:

Dim mainfrm As Form1 = New Form1()
mainfrm.ShowDialog()

or just

Application.Run(New Form1())

What is advantage of each way? And how to count how many times user started
application and let do it only once? Looks like Shared property can't do it.

Alex
 
H

Herfried K. Wagner [MVP]

alex9128 said:
I mean if you writing Sub Main in VB you can start you application either
way:

Dim mainfrm As Form1 = New Form1()
mainfrm.ShowDialog()

or just

Application.Run(New Form1())

What is advantage of each way?

In this particular situation 'Application.Run' is semantically correct, but
'ShowDialog' isn't, because the form should not be shown as a dialog.
And how to count how many times user started
application and let do it only once?

<URL:http://www.yoda.arachsys.com/csharp/faq/#one.application.instance>
 
H

hB

Dialog is model window other is modless.
if there are more than one gui forms/windows then it would effect.

"What is advantage of each way? And how to count how many times user
started application"
Perhaps on Application.Exit and Start of app, manipulate this
information in some text file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top