Can't get PrintJob in PrintJobCollection

Dec 19, 2011 at 8:58 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!