Results 1 to 4 of 4

Thread: Silly Newbie Problem [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Resolved Silly Newbie Problem [RESOLVED]

    I have an app with a Sub Main in a module which instantiates and shows a form like this:
    VB Code:
    1. Public Sub Main()
    2.   Dim frm As frmMain
    3.  
    4.   frm = new frmMain
    5.   frm.Show()
    6.  
    7. End Sub
    However, when I run my application, the form flashes up, disappears and my application ends.

    How can I make the application remain running until my form has unloaded (like VB6 did)?
    Last edited by simonm; Aug 8th, 2005 at 05:26 AM.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  2. #2
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: Silly Newbie Problem

    Quote Originally Posted by simonm
    I have an app with a Sub Main in a module which instantiates and shows a form like this:
    VB Code:
    1. Public Sub Main()
    2.   Dim frm As frmMain
    3.  
    4.   frm = new frmMain
    5.   frm.Show()
    6.  
    7. End Sub
    However, when I run my application, the form flashes up, disappears and my application ends.

    How can I make the application remain running until my form has unloaded (like VB6 did)?
    in vb6, it did not run the way usual programs do.. which is when all forms are closed the program ends, in vb.net now, when the main procedure is over, so is your program.

    You need to create a Do Loop
    You can make this end when your form goes invisible, or just using a boolean value
    VB Code:
    1. frm.show
    2. Do while frm.visible = True
    3.  application.doevents
    4. Loop

  3. #3
    Frenzied Member FishGuy's Avatar
    Join Date
    Mar 2005
    Location
    Bradford UK
    Posts
    1,708

    Re: Silly Newbie Problem

    VB Code:
    1. Dim frm As frmMain
    2.  
    3.   frm = new frmMain
    4.   'frm.Show()
    5.   Application.Run(frmMain)
    Last edited by FishGuy; Aug 8th, 2005 at 05:32 AM.

  4. #4

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Silly Newbie Problem

    Thanks Phill64 and FishGuy!
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width