can't show form from sub main

  • Thread starter Thread starter dennist
  • Start date Start date
D

dennist

Well I can, but it flashes on the screen then closes in
under a second. If I open one form from another, that
doesn't happen. The form stays there, as it should.

Hope somebody can help.

dennist
 
Hello,

dennist said:
Well I can, but it flashes on the screen then closes in
under a second. If I open one form from another, that
doesn't happen. The form stays there, as it should.

\\\
Public Sub Main()
Application.Run(New MainForm())
End Sub
///

HTH,
Herfried K. Wagner
 
Hello, dennist:
Just as Herfried said, Windows GUI Application runs in an event-driven
model, so there must be a message pipe to get
these messages from system and then dispatch them to the controls in the
form. It's similiar to
while(GetMessage(msg) )
{
ProcessMessage(msg);
DispatchMessage(msg);
}
The static method Application.Run will run the msg loop for you, You
should call Application.Run as Herfried's example, when you creating a new
form, Thanks.


Kind regards,

Ying-Shen Yu [MSFT]
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.

From: "Herfried K. Wagner [MVP]" <[email protected]>
Subject: Re: can't show form from sub main
Date: Sun, 10 Aug 2003 13:45:05 +0200
Newsgroups: microsoft.public.dotnet.framework.windowsforms

Hello,

dennist said:
Well I can, but it flashes on the screen then closes in
under a second. If I open one form from another, that
doesn't happen. The form stays there, as it should.

\\\
Public Sub Main()
Application.Run(New MainForm())
End Sub
///

HTH,
Herfried K. Wagner
 
Back
Top