On many of my forms I open and display other forms with ShowDialog(). At the top of the form I have.
Somewhere in the code of the form I wiil have something like this
These forms are then closed in the "calling" form closing event as follows.
Question # 1 - Do I have to do this?.
Question # 2 - If I'm doing this is there a way to find all of them and close them without repeating the code?
Auguy
Sylvania/Toledo Ohio
Code:
Private FindRecordForm As RecordFindForm
Private DisplayDetailForm As DisplayDetailForm
Code:
If FindRecordForm Is Nothing Then
FindRecordForm = New RecordFindForm
FindRecordForm.PropSearchType = FormTableName
End If
If FindRecordForm.ShowDialog() = DialogResult.OK Then
SelectData(FindRecordForm.PropSelectedPK)
End If
Code:
' Sample Form Cleanup
If Not FindRecordForm Is Nothing Then
FindRecordForm.Close()
FindRecordForm.Dispose()
FindRecordForm = Nothing
End If
If Not DisplayDetailForm Is Nothing Then
DisplayDetailForm.Close()
DisplayDetailForm.Dispose()
DisplayDetailForm= Nothing
End If
Question # 2 - If I'm doing this is there a way to find all of them and close them without repeating the code?
Auguy
Sylvania/Toledo Ohio