getting and setting the default printer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
How would you get and set the current default printer by using the
system.drawing.printing class or any other class.

Regards
Geri
 
Hi,


Use the wmi for that. The win32_printer class has the
setdefaultprinter method.


' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strOut As String

strOut = String.Format("Name {0} ", mo("Name"))

Trace.WriteLine(strOut)

mo.InvokeMethod("SetDefaultPrinter", Nothing)

Next



Ken

------------------------
message Hello,
How would you get and set the current default printer by using the
system.drawing.printing class or any other class.

Regards
Geri
 
Hi ken,
Thanx for the help, that allows me to set the default printer
perfectly, however how do I retrieve the default printer, as I need to
display this.

Regards
Geri.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top