Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6082471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:17:34+00:00 2026-05-23T11:17:34+00:00

I have a WPF form with a couple of buttons, and for each button

  • 0

I have a WPF form with a couple of buttons, and for each button I have error handling code:

try {bla bla} 
catch(Exception e){
  more bla
}

Is there any way I can set something up on the application level or something that will just catch all uncaught errors and display some generic message/ log the error? Now I have to create handling for every button so the code doesn’t crash. It’s an internal app so just displaying the message from whatever was thrown down there will suffice. After that the app would just wait for the next button click, so it wouldn’t have to do anything afterwards.

There so much repetive code right now, wondering if there is some way to consolidate that and only deal with cases where there is a specific way to handle a specific error.

Regards Gert-Jan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:17:35+00:00Added an answer on May 23, 2026 at 11:17 am

    There are multiple possibilities:

    1. Suggestions for making a reusable try/catch block in C#?
    2. If you have a Winforms application, subscribe to the events Application.ThreadException and AppDomain.CurrentDomain.UnhandledException: http://www.csharp-examples.net/catching-unhandled-exceptions/
    3. If you have a WPF application, subscribe to Application.DispatcherUnhandledException and AppDomain.CurrentDomain.UnhandledException
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF Form which has many buttons with the same code. Appearance of
I have a WPF form which contains 30x30 grid where each grid cell is
I have a WPF form with 3 buttons and have routed events on them,
On my wpf form i have image and toggle button controls. On image mouse
I have a WPF form with Next and Prev buttons for navigating to the
I have a WPF form containing a button and a progress bar element. When
I have more than 20 checkboxes in my wpf form. I need store IsChecked
I have a WPF form that has some buttons to save user input, delete,
I have a login button in wpf login form. I want that user has
I have a WPF form where I'm trying to make a simple input form.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.