form.show not working

  • Thread starter Thread starter Robert Smith
  • Start date Start date
R

Robert Smith

Hello,
I have a problem with my form.show not working. I have
a standard forms collection class as follows:

Public Class FormsCollection
Inherits CollectionBase

Public Shadows Function Add(ByVal FormObject As
Form) As Form
MyBase.List.Add(FormObject)
Return FormObject
End Function

Public Shadows Sub Remove(ByVal FormObject As Form)
MyBase.List.Remove(FormObject)
End Sub

End Class


In my start up form I want to initiate another form using
the code
Dim myform As Form
myform = New FrmProjectTree
myform.Show()
Me.Close()

I have the usual forms.add(me) and forms.remove(me) in
each form so that they are added to the collection each
time they are loaded.
Any ideas why this form.show won't work. the program just
quits without an error message

Regards
Robert
 
You're probably closing the main form. That's the default behavior --
whatever form instance you pass to Application.Run() is the main form;
when it closes, the app exits.

You can change this behavior with a little extra coding. Look in the
docs for the ApplicationContext class; there's an example there.
 
Back
Top