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

Discussion in 'Microsoft VB .NET' started by alex9128, Jul 29, 2005.

  1. alex9128

    alex9128 Guest

    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
     
    alex9128, Jul 29, 2005
    #1
    1. Advertisements

  2. "alex9128" <> schrieb:
    > 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>

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>
     
    Herfried K. Wagner [MVP], Jul 29, 2005
    #2
    1. Advertisements

  3. alex9128

    hB Guest

    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.

    ---
    hB
     
    hB, Aug 10, 2005
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Graybeal

    Values differ after assigning 1 string to another

    Stephen Graybeal, Aug 21, 2003, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    433
    Stephen Graybeal
    Aug 21, 2003
  2. Mike Walters

    Application.Run() and ShowDialog error

    Mike Walters, Apr 14, 2004, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    833
    Peter Huang
    Apr 23, 2004
  3. dbuchanan
    Replies:
    2
    Views:
    827
    Chris
    Oct 4, 2005
  4. Hexman
    Replies:
    7
    Views:
    178
    Hexman
    Jun 29, 2006
  5. DaveP
    Replies:
    3
    Views:
    748
    DaveP
    May 23, 2008
Loading...

Share This Page