Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I take a screen shot

Status
Not open for further replies.
Mar 9, 2006
93
CA
I have an application and when certain errors are committed I would like to take a screen shot and save it to a file (.jpg). Does anyone know how I can do this?
Thanks
Matt
 
I am going to catch the error using a try/catch block but on certain errors I want to take a screen shot.
Thanks
Matt
 
As arznrchrd asked, i am going to ask too.
Why screenshot? To get a screenshot, the program crashes first and then get the screenshot.. from an other thread? Anyway, i would not follow this. Trap the line that might throuw any exception and Catch ex as exception should give you all the info you want. So by 'ex.<..>' you may know the sender, the event, the message, the code, the inner exception, the stacktrace...everything. Furthermore, you can write multiple catches and catch all other exceptions specifically, e.g. catch ex as fileioexception. Even if you dont do that, you can catch all the exceptions, as the 'exception' is the base clase.

Hope these help
 
Screen shots can be handy because they can show us what the user had typed in when the error occurred. Sure, we could write code to pull out all of the values on the form and store those with the rest of the exception information, but this is quick and generic. And it is extremely useful in debugging the issue to be able to have all of the info with out having to call the user and ask them what they were doing, what record they were looking at, etc...

My recommendation though, don't bother with the print screen, grab the handle for the window and use BitBlt to capture and image. (Google for: vb.net bitblt screen capture to find samples)

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
I can understand the need to do screen captures. Nor does it mean an application has to crash first.

I use an imageing system. At times it can't find a file because 1) the file isn't on the hard drive 2) The media that the file is on isn't in the juke box. 3) Other errors.

most of my users can't really read and understand the error message that is displayed. They do a scrren print and email it to me. Doesn't mean the application has crashed, just means a resource can't be found and a screen shot is very helpful. (not that most users really know how to do a screen capture either, but still...)
 
Alrite I managed to figure it out. Thank you everyone for your help.
Thanks
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top