Iv got a little bit of a threading problem.
Iv got a form which handles events fired by an object running on
another thread (the event handlers are executed on a thread differnet
from the form's gui thread). Im using BeginInvoke to call methods on
the form that manipulate its GUI elements, as is reuqired. The problem
is this: When that particular form is closed and the object is still
running, the events still fire and get caught by the event handlers.
The BeginInvoke call fails with an InvalidOperationException (something
about the window handle not being created). Although i can catch this
excpetion and ignore it, doing this would slow down my prgoram alot and
would break the guideline of not having exceptions thrown during normal
program execution (it is normal for this form to be closed, as it is a
helper form). How do i check if the form is open and has a window
associated with it? 4 6433
Hello,
I would recommend you to handle the Form's Closed event. Your handler
simply detaches every registered event handler which gets executed on your
form.
greets
On Fri, 22 Jul 2005 18:30:22 +0200, Michael Gorbach <mg******@gmail.com>
wrote: Iv got a little bit of a threading problem. Iv got a form which handles events fired by an object running on another thread (the event handlers are executed on a thread differnet from the form's gui thread). Im using BeginInvoke to call methods on the form that manipulate its GUI elements, as is reuqired. The problem is this: When that particular form is closed and the object is still running, the events still fire and get caught by the event handlers. The BeginInvoke call fails with an InvalidOperationException (something about the window handle not being created). Although i can catch this excpetion and ignore it, doing this would slow down my prgoram alot and would break the guideline of not having exceptions thrown during normal program execution (it is normal for this form to be closed, as it is a helper form). How do i check if the form is open and has a window associated with it?
Hello,
I would recommend you to handle the Form's Closed event. Your handler
simply detaches every registered event handler which gets executed on your
form.
greets
On Fri, 22 Jul 2005 18:30:22 +0200, Michael Gorbach <mg******@gmail.com>
wrote: Iv got a little bit of a threading problem. Iv got a form which handles events fired by an object running on another thread (the event handlers are executed on a thread differnet from the form's gui thread). Im using BeginInvoke to call methods on the form that manipulate its GUI elements, as is reuqired. The problem is this: When that particular form is closed and the object is still running, the events still fire and get caught by the event handlers. The BeginInvoke call fails with an InvalidOperationException (something about the window handle not being created). Although i can catch this excpetion and ignore it, doing this would slow down my prgoram alot and would break the guideline of not having exceptions thrown during normal program execution (it is normal for this form to be closed, as it is a helper form). How do i check if the form is open and has a window associated with it?
ah ... great idea. I dont know why i didnt think of that.
For some reason the first thing comming into my head was to check in
the method that calls the begininvokes.
ah ... great idea. I dont know why i didnt think of that.
For some reason the first thing comming into my head was to check in
the method that calls the begininvokes. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jon |
last post by:
I am writing an MDI app that uses a document manager class
to keep track of opened child windows. I want the user to
be able to close a child window, but then re-open the
window from the "Window"...
|
by: Michael Gorbach |
last post by:
Iv got a little bit of a threading problem.
Iv got a form which handles events fired by an object running on
another thread (the event handlers are executed on a thread differnet
from the form's...
|
by: Bande |
last post by:
There is a program in VB , in which, there is a
Form_QueryUnload( Cancel as Integer, UnloadMode as Integer)
which would be called when the form is being closed. The UnloadMode is used to find...
|
by: Xero |
last post by:
How do you detect whether a form has been closed or not?
Thanks.
--
Xero
http://www.chezjeff.net
My personal web portal
|
by: Geoff Jones |
last post by:
Hiya
Supposing a form has been created as follows:
Dim form1 As New Form
How can I check to see if the form has been closed i.e. by clicking on the
cross in the top right of the form.
...
|
by: Gaby |
last post by:
Hi guys,
I have this ASP code that is a little long to post so but you can
download it off of
http://whatthedeuce.net/Form.asp
I cant find out what my error is. I know it is not in my Access...
|
by: Mike Baugh |
last post by:
I am using visual studio 2005 to develop a form using c#
I have 3 datagrids on one form.
I can set the row color based on a certain value in a column. However this
color applies to all 3...
|
by: Zytan |
last post by:
I have created a new form from the main form. When I close the main
form with the 'x' close button, its Form.FormClosed event is run, but
not the dialog's.
Is this normal? It is ok /...
|
by: Anil Gupte |
last post by:
I have a MDI Parent Child set of forms
FormContainer --MDIParent
FormStart --MDIChild
FormMain-->MDIChild
FormSliceInfo-->MDIChild
I use the following in the beginning of FomrContainer
...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |