|
-
Apr 29th, 2002, 10:52 AM
#1
Thread Starter
Member
Displaying windows forms from a module
I am trying to display forms from a module with this code:
Public Sub Main()
Dim SomeForm as New Form()
Dim SomeOtherForm as New Form()
SomeForm.Show()
SomeOtherForm.Show()
End Sub
The forms display (very) briefly, then vanish. My program then ends, and control is returned to the IDE. I have tried using the .ShowDialog method to make the forms persist (makes them modal), but of course then the problem is that you cannot display both forms concurrently. What am I doing wrong here? In VB6, once you loaded and showed forms, they would persist until closed.
--Steve K.
[email protected]
-
Apr 29th, 2002, 06:44 PM
#2
Basically, your app ends when Main stops running. What you have to do is put a line that looks something like this at the end:
Application.Run(FormVariableName)
..where FormVariableName is the name of a variable that references your main form. I don't have VB.NET here, so I might've gotten the name of the class wrong. It looks right, tho.
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
|