Display modeless form from Sub Main

  • Thread starter Thread starter Rami
  • Start date Start date
R

Rami

My project starts with Sub Main and then needs to display
a modeless form.
From some reason the application closes it self after
calling the Show method.
How can I avoid the application from being closed.
By the way in VB6 there is no problem to do it.
This is the code I have:

Option Explicit On

Module Module1

Public f1 As New Form1()

Sub main()
f1.Show()
End Sub
End Module
 
Hi Rami,

Sub main()
f1.Show()
Application.Run
End Sub

Application.Run will start the message pump going so that windows in the
thread (ie f1) have a working message queue.

Regards,
Fergus
 
Hello,


Rami said:
My project starts with Sub Main and then needs to display
a modeless form.
From some reason the application closes it self after
calling the Show method.
How can I avoid the application from being closed.
By the way in VB6 there is no problem to do it.
This is the code I have:

Option Explicit On

Module Module1

Public f1 As New Form1()

Sub main()
f1.Show()
End Sub
End Module

\\\
Application.Run(New Form1())
///
 
Back
Top