r/visualbasic • • Apr 20 '21

VB.Net Console Installed Printers

Could someone give me an example of how to get a list of printers and display them in the console window? Right now I am empty handed, I have exhausted all the code I can find on Google and nothing is working.. using system drawing - installedprinters? Sorry don't know much more than that.

I am trying to create a vb.net console app in vs2019

6 Upvotes

2 comments sorted by

5

u/banshoo Apr 20 '21
import System.Drawing.Printing

Then in code:

Dim InstalledPrinters as String

For Each InstalledPrinters In PrinterSettings.InstalledPrinters
    console.write(pkInstalledPrinters.tostring)
Next

2

u/hacnstein Apr 20 '21

That looks like every other code I've attempted, all I had to do was remove the 'pk' and it works great!!! I SO appreciate your time and code! Hopefully I can finish the rest of my plan.