Hi,
I have a Windows App which uses a custom form to display messages.
This form is based on the singleton pattern so that the user does not need
to explicitly create an object of this form.
After the Showdialog() method on this form, do i need to dispose this form
explicitly. i distinctly remember one article saying that all Modal forms
needs to be disposed explicitly.
This is the code snippet i am using:
Public Class myMessageForm
Private Sub New()
'new instance not possible
End Sub
private Shared frmMsg as MyMessageForm = Nothing
Public Shared Function Display(ByVal text as String) as DialogResult
If frmMsg is nothing then
frmMsg = New MyMessageForm
End If
'Set some properties
Return frmMsg.ShowDialog()
End Function
Calling Code:
If txtCustId.text.Length = 0 Then
MyMessageForm.Display("Invalid Customer Id")
End If
Any help would be appreciated.
TIA :)