Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1672
  • Last Modified:

C# Obtaing Network Printer location

Hi.

Im Current working with a c# form..
I have a listbox with printernames and a label
When user click this listbox I want to set label.Text = PrinterLocation.
How do i get the location of my network printer so i can put it ine the label?
0
Balltown
Asked:
Balltown
2 Solutions
 
kvimalCommented:
0
 
ShazbotOKCommented:
here is a less expensive way to do this (no dependancies on permissions to WMI:
            foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
            {
                //this will iterate through each printer installed on the system with a full UNC
                if (printer.ToLower().EndsWith(listbox.Text.ToLower()))
                {
                    //this is your printer name so here it is...
                }
            }
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now