D
Dean Slindee
When launching another form from the current form, I use the code below to
determine if the form to be launched is already active and showing. If
form = Nothing, then I instantiate it, otherwise I just set it's properties
and refresh the form.
Problem is: when the form already been shown and closed using it's X button
(sending the form thru it's Closing and Disposed events), and then an
attempt is made to reinstantiate it again, the form is NOT Nothing, and
falls into the Else clause below. This generates an error message"
"Cannot access a disposed objected named "frmRecord". Object name:
"frmRecord".
Is this a case of slow garbage collection, and/or is there a way to set a
form to Nothing in the form's Closing or Disposed events?
If frmRecord Is Nothing Then
frmRecord = New frmRecord(intFormatID, intRecordID, FormMode.Edit)
frmRecord.Show()
Else
frmRecord.Mode = FormMode.Edit
frmRecord.RecordID = intRecordID
frmRecord.FormPaint(intRecordID)
frmRecord.Show()
End If
Thanks,
Dean Slindee
determine if the form to be launched is already active and showing. If
form = Nothing, then I instantiate it, otherwise I just set it's properties
and refresh the form.
Problem is: when the form already been shown and closed using it's X button
(sending the form thru it's Closing and Disposed events), and then an
attempt is made to reinstantiate it again, the form is NOT Nothing, and
falls into the Else clause below. This generates an error message"
"Cannot access a disposed objected named "frmRecord". Object name:
"frmRecord".
Is this a case of slow garbage collection, and/or is there a way to set a
form to Nothing in the form's Closing or Disposed events?
If frmRecord Is Nothing Then
frmRecord = New frmRecord(intFormatID, intRecordID, FormMode.Edit)
frmRecord.Show()
Else
frmRecord.Mode = FormMode.Edit
frmRecord.RecordID = intRecordID
frmRecord.FormPaint(intRecordID)
frmRecord.Show()
End If
Thanks,
Dean Slindee