dastaub
asked on
User Friendly Printer Name
The below loop populates the listbox with all available printers. The problem is the printers are listed as \\DELL09\HP Laser Jet 5050ii instead of "Front Desk Laser" Is there a way to tap the location or comment field associated with the network printers? The end user will understand those choices better.
Dim mPrinterNames As String
ListBox1.Items.Clear()
For Each mPrinterNames In System.Drawing.Printing.Pr interSetti ngs.Instal ledPrinter s
ListBox1.Items.Add(mPrinte rNames)
Next mPrinterNames
Dim mPrinterNames As String
ListBox1.Items.Clear()
For Each mPrinterNames In System.Drawing.Printing.Pr
ListBox1.Items.Add(mPrinte
Next mPrinterNames
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You. There always appears to be a class to access the property, method, or event that you want to get to.
You can use the ManagementClass to do this. The snippet contains an example. In the example, I have used the Comment, Location and Name properties in that order of preference. Of course, these (and other properties) could be combined to give a more complete description in the ListBox.
Note that you need to add a reference to System.Management.dll to your project to use this.
Cheers,
Randy
Open in new window