I'm having a problem (most likely an understanding) with forms in WinCE. So as i don't post complicated code i have replicated the problem in a simple example;
Public Class frmMain
Private Sub btnForm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForm2.Click
Form2.Show()
End Sub
End Class
Public Class Form2
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Hide()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
This works well with the buttons opening and closing the forms as required however, i want to change the Form 2 event (btnClose) so that the form closes thus removing any controls i add on the fly. If i change the event to Me.Close() the form closes but i cannot open it again with the button in Form 1 ie: Form2.Show().(Why i don't know).
I have tried removing the controls on Form2 just before the hide, but on showing the form again (Form2.Show) it doesn't goto Form2_Load so new controls are not added thus my reason for wanting to 'Close' Form2.
So my question is why does the Form2.Close stop the form from showing a second time and what is the workaround? - i'm sure this is just my poor understanding of WinCE forms. Any ideas?