473,804 Members | 3,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

throwing exceptions out of a gui event handler

Is it possible to override the default behavior and prevent the framework
from catching any exceptions leaving these methods and allow the app to
handle them elsewhere?
Nov 17 '05 #1
2 3053
Hello Dan,

You cant cacth exception that occured in the event handler unless you do
it in the handler itself.
As far as I remeber its because event executed on different thread and you
might not know when specific even happend and which one( in case more then
one handler was attached to it).

Try to define global application event handler and see if it works for you.

Hope it helps,
Oleg
Is it possible to override the default behavior and prevent the
framework from catching any exceptions leaving these methods and allow
the app to handle them elsewhere?

Nov 17 '05 #2


"Oleg Kap" wrote:
Hello Dan,

You cant cacth exception that occured in the event handler unless you do
it in the handler itself.
As far as I remeber its because event executed on different thread and you
might not know when specific even happend and which one( in case more then
one handler was attached to it).

Try to define global application event handler and see if it works for you.


I currently have a global handler, and was trying to get the exception out
to it (most of my work is done by the gui calling DoFoo() methods). If I
can't do it I guess I could write a GlobalException Handler(excepti on e)
method to call from the catch block and use type checking to figure out
exactly what type of exception was passed in, but that seems a rather ugly
solution. Alot of my processing is done in nonGui dlls so I can't display
messageboxes and shutdown at the point where they're thrown from.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
3035
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. I have a list in a particular order that I want to split into two lists: the list of every nth item, and the list of remaining items. It's important to maintain the original order in both lists. So the first list is simple:
6
4203
by: Iain | last post by:
Hey folks, (I posted this in microsoft.public.dotnet.csharp.general yesterday, but it appears that this group is rather more lively) For the application I am developing, I have a data access layer that handles all the talking to the database. There are only certain exceptions that I want to excape from this class, and all of them should have sensible meanings - for instance, there should be a "The database is not happy" and "There is...
10
8564
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
10
2044
by: Jeff | last post by:
I'm just starting to work with UserControls and have a question on the behavoir of exceptions within UserControls and VS.Net 2003. I have noticed that when a UserControl throws an exception from an event (i.e. Click event), VS.Net will enter debug mode on the exact line that threw the exception in the UserControl. You can see the complete call stack up to the Click event, all local variables from the Click event, etc. However, if an...
40
13541
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
6
6469
by: Leslie | last post by:
I am attempting to handle errors by using Application_Error. This seems to work fine in most situations. However, if the exception occurs during the Application_Start method, the stand error screen is displayed and my custom error handling in Application_Error does not run. Why does this occur, and is there something I can do to cause Application_Error to be automatically invoked during an Application_Start exception?
2
1309
by: Eric Sabine | last post by:
I built a generic exception handler form which allows the user to get information from it, print it, email it, etc. for exceptions for which I explicitly didn't handle in code, such as missing permissions on a stored procedure, etc. I use this exception handler in all of my applications and it can be called as simply as follows try ... catch ex as sqlexception ExceptionHandler(ex, otherData1, otherData2)
7
5149
by: Sek | last post by:
Hi Folks! I was pondering over a code and noticed that exception handlers were present in the private, protected as well as public methods. And, ofcourse, public methods were calling priv/prot methods internally. My thought was, the exception is being rethrown and propagated by the non-public methods to the public methods, causing performance overhead (stack winding etc). I do agree that, the purpose of throwing the exception by...
9
5841
by: thagor2008 | last post by:
Is the behaviour of throwing exceptions in a unix signal handler defined? eg: void sighandler(int sig) { ... do something throw myobj; }
0
9704
marktang
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...
0
9569
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,...
0
10318
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
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...
0
9130
agi2029
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...
1
7608
isladogs
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...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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 we have to send another system
3
2975
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.