Solved

Print Queue Exception - How Do I Catch It?

Posted on 2009-07-01
5
927 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 ITIL
ID: 24752523

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
ID: 24752803
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 ITIL
Rahul Goel ITIL earned 20 total points
ID: 24755663
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
ID: 24780364
And how do I do that?
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 0 total points
ID: 24794516
Anybody able to help solve this?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML - Color not displaying correctly in EMAIL. 6 49
jquery + C#.net radiobuttonlist 3 30
Input parameteres to DragOver 2 19
Why use this lambda? 12 33
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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