I think what you say about the primary thread is pretty close: The startup
object for your application contains (somewhere within the framework) the
main message loop, which is responsible for handling messages from the
operating system. It's the entry point and center of your process: when it
stops sending the I'm-still-here message, the process is gone.
If you change the start object to Sub Main in project properties, you can
call Application.Run() to create a message loop. Call it just after
form1.Show(), like this:
Module Module1
Sub Main()
Dim first Form As New Form1()
mainForm.Show()
Application.Run()
End Sub
End Module
Michael
-----Original Message-----
From: Tom Deseyn [mailto:tom_deseyn@h...]
Sent: Tuesday, June 11, 2002 2:36 PM
To: pro_VB_dotnet
Subject: [pro_vb_dotnet] Re: Passing control to another form
Hello,
I also have the problem of Robert. In VB6 OOP was really easy because you
were designing your forms as if they were instances instead of clases.
Roberts problem ( and mine too ) is the following:
problem:
A project consists of two forms , form 1 and form 2
form 1 is the startup form and contains some fields for input
when the user had typed and selected ... the necessary data, he pushes a
button which closes form 1, opens form 2 and allows form1 to use the data on
form1.
solutions:
1. Off course you could hide the form1 instance instead of closing it, but
actually we don't need it anymore once we have extracted the data out of it,
it's just filling our RAM.
2. One way is to start with form2 as startup form , keep it hidden till the
user had filled in form2.
the actual problem:
But that is just a way round the problem, the actual problem is that a
running applications ends when the startup form is closed. I THINK this is
because the startupform is running in the primary thread, and other forms
are not ( unless the are running modal ). When the startup form is closed ,
the primary thread ends and the application closes down. So how can we make
an other form than the start up form as the primary form of our project ?
-------------
Tom Deseyn