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 3 1428
"Dean Slindee" <sl*****@charter.net> schrieb 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?
Handle the other Form's closed event, and in the event handler, set the
variable = Nothing.
Or:
If frmRecord Is Nothing OrElse frmRecord.IsDisposed Then
frmRecord = New frmRecord(intFormatID, intRecordID, FormMode.Edit)
Else
frmRecord.Mode = FormMode.Edit
frmRecord.RecordID = intRecordID
frmRecord.FormPaint(intRecordID)
End If
frmRecord.Show()
frmRecord.activate
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
this isn't related to the actuall question - however, when I was looking for
isdisposed, it wouldn't show up in the intellisense neither for the form nor
for an object of type 'Control'. ofocurse, it shows up in the object browser
for the Control. am i missing something here?
"Armin Zingler" wrote: "Dean Slindee" <sl*****@charter.net> schrieb 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?
Handle the other Form's closed event, and in the event handler, set the variable = Nothing.
Or: If frmRecord Is Nothing OrElse frmRecord.IsDisposed Then frmRecord = New frmRecord(intFormatID, intRecordID, FormMode.Edit) Else frmRecord.Mode = FormMode.Edit frmRecord.RecordID = intRecordID frmRecord.FormPaint(intRecordID) End If
frmRecord.Show() frmRecord.activate
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"ISK" <IS*@discussions.microsoft.com> schrieb this isn't related to the actuall question - however, when I was looking for isdisposed, it wouldn't show up in the intellisense neither for the form nor for an object of type 'Control'. ofocurse, it shows up in the object browser for the Control. am i missing something here?
Menu Tools -> Options: Text-Editor -> Basic -> General: uncheck "Hide
advanced members"
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Kruse |
last post by:
See: http://www.mattkruse.com/temp/window_closed.html
It looks like the .closed property of a window is inaccessible if the
window is actually closed. Other browsers have no problem detecting...
|
by: Bob |
last post by:
Hi Everybody
I have a form called frmListBox that is connected to a table tblListBox.
This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder"
and...
|
by: news.microsoft.com |
last post by:
Hi everyone,
I need some help (may be in the form of some sample code) for the subject
question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the
session ends. I...
|
by: Ali |
last post by:
i am using visual studio 2005 and I am trying to create a popup calender so
when a user click on a image on the main form, a calender will then popup,
the user will select a date and the date will...
|
by: tshad |
last post by:
This is from my previous post, but a different issue.
I have the following Javascript routine that opens a popup page, but doesn't
seem to work if called from an asp.net button. It seems to work...
| |
by: RD |
last post by:
Dim myfrm as new frmb
myfrm.show()
Dim myfrm2 as new frmc
myfrm2.show
Opens two forms from a butom located on forma
when I close forma I would like both form myfrm and for myfrm2 to close...
|
by: SamSpade |
last post by:
I declare a variable X of type myForm then instantiate myForm saving a
reference in the variable X, and then do X.Show.
If I need to know if the form has been shown yet, I check X against...
|
by: SamSpade |
last post by:
I need a MDI form to be notified when one of it's child closes.
I could define an event in each child and raise it when it closes.
But if there is some WinProc message that occurs when a child...
|
by: Simon Verona |
last post by:
I have a parent form which contains a toolbar. The toolbar controls the
loading and switching to of MDI child forms.
The code for the toolbar click event and one of the subroutines that loads...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |