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(intFo rmatID, intRecordID, FormMode.Edit)
frmRecord.Show( )
Else
frmRecord.Mode = FormMode.Edit
frmRecord.Recor dID = intRecordID
frmRecord.FormP aint(intRecordI D)
frmRecord.Show( )
End If
Thanks,
Dean Slindee 3 1439
"Dean Slindee" <sl*****@charte r.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.IsDis posed Then
frmRecord = New frmRecord(intFo rmatID, intRecordID, FormMode.Edit)
Else
frmRecord.Mode = FormMode.Edit
frmRecord.Recor dID = intRecordID
frmRecord.FormP aint(intRecordI D)
End If
frmRecord.Show( )
frmRecord.activ ate
--
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*****@charte r.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.IsDis posed Then frmRecord = New frmRecord(intFo rmatID, intRecordID, FormMode.Edit) Else frmRecord.Mode = FormMode.Edit frmRecord.Recor dID = intRecordID frmRecord.FormP aint(intRecordI D) End If
frmRecord.Show( ) frmRecord.activ ate
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"ISK" <IS*@discussion s.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
that the window has been closed. Opera 7.11 and 7.20b7 both throw
errors when trying to check the .closed property.
Is this a bug in Opera, or do I have to (once again) take special
action to make normal javascript work with Opera?
|
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 floats above (ie is pop-up) !
Private Sub ListBox_DblClick(Cancel As Integer)
DoCmd.OpenForm "Forms!!!.Form! = Me!ListBox.Column(1)
Forms!!.Form! = Me!ListBox.Column(2)
|
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 don't want to depend on the session timeout factor since it
may end too soon or it may hang around too long. I can't find any event
that fires when the browser closes. The Session_End event handler in the
Global.asax does not execute until the...
|
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 then be passed back to the main
form and populate a textbox. it works fine. but when i used master page for
all my pages and i put the textbox inside the content , the calender pops up
but when i select the date nothing happens .. the textbox was...
|
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 fine from a
link.
The button does bring up the popup window, but when I press the links on the
page, it doesn't return or close the window.
****************************************************************************
| |
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
automatically
|
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 Nothing.
If the users closes MyForm I'd like X to be set to Nothing but don't know
how to sense (except in MyForm) that myForm is closing.
In the myForm's Closing event if I set Me=Nothing will that set X to
Nothing?
|
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 closes I would
rather use it and automate the process.
Second question. When a form Closed event occurs is the form then disposed.
I want to check the variable that references the form and if the form is
|
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
and shows a child form is:
Private Sub tbMenu_ButtonClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ToolBarButtonClickEventArgs) Handles tbMenu.ButtonClick
Dim btn As System.Windows.Forms.ToolBarButton
For Each btn In...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |