|
-
Aug 8th, 2005, 05:07 AM
#1
Thread Starter
Fanatic Member
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:
Public Sub Main()
Dim frm As frmMain
frm = new frmMain
frm.Show()
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. 
-
Aug 8th, 2005, 05:12 AM
#2
Re: Silly Newbie Problem
 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:
Public Sub Main()
Dim frm As frmMain
frm = new frmMain
frm.Show()
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:
frm.show
Do while frm.visible = True
application.doevents
Loop
-
Aug 8th, 2005, 05:15 AM
#3
Frenzied Member
Re: Silly Newbie Problem
VB Code:
Dim frm As frmMain
frm = new frmMain
'frm.Show()
Application.Run(frmMain)
Last edited by FishGuy; Aug 8th, 2005 at 05:32 AM.
-
Aug 8th, 2005, 05:26 AM
#4
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|