Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Printer Enumeration

Greetings all,

I'm wondering if there is a more resource-efficient way of retrieving the list of installed printers on a given system. I've written this in VB.NET on my laptop (2.33ghz Core Duo, 2GB Ram) and it noticeably lags my laptop. I ran this code on a fairly standard machine and the result was very, very slow.

Dim x As Integer = 0
For x = 0 To Printing.PrinterSettings.InstalledPrinters.Count() - 1
cmbPrintername.Items.Add(Printing.PrinterSettings.InstalledPrinters.Item(x))
Next

Is there a quicker way to retrieve this information from the system? Thanks in advance.

-kryologik
[680 byte] By [kryologik] at [2007-11-11 10:08:48]
# 1 Re: Printer Enumeration
On my machine (XP 2.66 P4 w/ 1 GB) this only takes 15 ticks (using tickcount) to enumerate 3 networked printers. If it's slow for you, I don't believe the code is the problem.
joewmaki at 2007-11-11 20:48:30 >