Can't get PrintJob in PrintJobCollection

Dec 20, 2011 at 8:19 AM

Hello,

        I want to get PrintJob in PrintJobCollection but i get an error:

 Error CS0030: Cannot convert type 'System.Collections.Generic.KeyValuePair<int,PrinterQueueWatch.PrintJob>' to 'PrinterQueueWatch.PrintJob'

      Followint is my code:

PrinterMonitorComponent pmc = new PrinterMonitorComponent();

.....

PrintJobCollection printJobs = pmc.PrintJobs;
Console.WriteLine(printJobs.Count); // i can get printJobs count

foreach(PrintJob job in printJobs){
                    Console.WriteLine(job.UserName);
                    Console.WriteLine(job.Document);
                    Console.WriteLine(job.DataType);
                }

 

 

BR!

Coordinator
Dec 20, 2011 at 10:30 PM
Try PrintJobs.Values

On 20 Dec 2011, at 08:19, "dxdnj"<notifications@codeplex.com> wrote:

From: dxdnj

Hello,

I want to get PrintJob in PrintJobCollection but i get an error:

Error CS0030: Cannot convert type 'System.Collections.Generic.KeyValuePair<int,PrinterQueueWatch.PrintJob>' to 'PrinterQueueWatch.PrintJob'

Followint is my code:

PrinterMonitorComponent pmc = new PrinterMonitorComponent();

.....

PrintJobCollection printJobs = pmc.PrintJobs;
Console.WriteLine(printJobs.Count); // i can get printJobs count

foreach(PrintJob job in printJobs){
Console.WriteLine(job.UserName);
Console.WriteLine(job.Document);
Console.WriteLine(job.DataType);
}

BR!

Dec 21, 2011 at 3:42 PM

Dear Merrion,

       Thank you for you help.

       I have download the latest release verion to fix this question.

       But , i get a new question, how  to get a document content which is printed ?

      Could you give me some tips or more information?

BR.