Tuesday, August 05, 2008

Handy WinForm Dialog Box Error Trick

You may not have realized it, but you can quickly copy error messages off WinForms dialog boxes with Ctrl-C.  You'll get something like this below:

---------------------------
My Dialog's Title/Caption
---------------------------
My Dialog's message text
---------------------------
OK   (List of buttons here)
---------------------------

This makes it quick to copy error messages into bug reports.

(Not that I've ever written a single line of code with a bug in it, mind you. I'm just saying.)

3 comments:

Brandon Schenz said...

I don't write code with bugs either :).

However I do wrap every sub and function in a try catch block. If an exception occurs notify the user, log the exception (generally to a text file, but possibly the application log), and if I do not explicitly deal with the exception it must be re thrown.

The most important parts of this are user notification (and not a cryptic message, but something that lets them know that we have a problem and how to get me the report), and make a report of the exception.

Jim Holmes said...

Try/catch blocks are a critical part of dev, Brandon. I'm pointing out something higher than that -- like the message you're tossing out to a user after you've handled that exception. Being able to quickly grab the message text is really handy for QA testers or users. It's another piece of the puzzle to couple together with your logs.

But your points are good ones!

Matt Blodgett said...

That's one of my favorite Windows tricks. Unfortunately, I only learned about it a couple years go. It brings tears to my eyes to think of all those error messages I carefully transcribed into Notepad before I learned this trick.

Subscribe (RSS)

The Leadership Journey