how to load a form from module?

  • Thread starter Thread starter jernej goricki
  • Start date Start date
J

jernej goricki

Hi,
Im trying to load a form from sub main in my module like this:

Module MainModule
Sub main()
Dim StartForm As MainFrame
StartForm = New MainFrame()
StartForm.Show()
End Sub
End Module

But the form just blinks for a second and then it dissapears??
Why??
 
Pass your form to Application.Run like so,

Module MainModule
Sub main()
Dim StartForm As MainFrame
StartForm = New MainFrame()
StartForm.Show()
Application.Run(StartForm)
End Sub
End Module

Regards
Neal
 
* "jernej goricki said:
Im trying to load a form from sub main in my module like this:

Module MainModule
Sub main()
Dim StartForm As MainFrame
StartForm = New MainFrame()
StartForm.Show()
End Sub
End Module

But the form just blinks for a second and then it dissapears??
Why??

The problem is that your application doesn't have a message loop --
that's why the form will be closed. Use 'Application.Run(StartForm)'
instead of showing the form.
 
Back
Top