Solved

Print Queue Exception - How Do I Catch It?

Posted on 2009-07-01
5
903 Views
Last Modified: 2013-11-07
Should see like a relatively obvious one, but I'm unable to actually state that I want to catch this particular type of exception.  Debugging shows that it is of type PrintQueueException, but it never appears in intellisense.  Googling has shown a couple of similar problems but hasn't given me an indication of a solution, and due to standards I can't just catch type Exception.

Does anybody know how I can handle this issue?
0
Comment
Question by:angus_young_acdc
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:Rahul Goel
Comment Utility

I hope this could help you
System.Management.ObjectQuery oq = new System.Management.ObjectQuery

"SELECT * FROM Win32_PrintJob");

ManagementObjectSearcher query1 = new ManagementObjectSearcher(oq);

ManagementObjectCollection queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )

{

Console.WriteLine("Printer Driver : " + mo["DriverName"].ToString());

Console.WriteLine("Document Name : " + mo["Document"].ToString());

Console.WriteLine("Document Owner : " + mo["Owner"].ToString());

Console.WriteLine("==================================");

}

Open in new window

0
 
LVL 15

Author Comment

by:angus_young_acdc
Comment Utility
Hi mate,

Thanks for the code but I'm already returning the printer information that I need, I just need to know how to catch the PrintQueueException as it's unavailable in intellisense.
0
 
LVL 9

Assisted Solution

by:Rahul Goel
Rahul Goel earned 20 total points
Comment Utility
you can not trap the exception using PrintQueueException class, you can get this class under System.Printing

refer to the following link:
http://msdn.microsoft.com/en-us/library/system.printing.printqueueexception.aspx
0
 
LVL 15

Author Comment

by:angus_young_acdc
Comment Utility
And how do I do that?
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 0 total points
Comment Utility
Anybody able to help solve this?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now