I am trying to get get the status of a specific printer stored as a variable so something happens when it is printer, or idling, etc. I am able to retrieve the status of all the printer connected to my PC(see code below). How to I set the status of a Pinter as a variable?
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strPrintServer As String, WMIObject As String, PrinterSet As Object, Printer As Object
strPrintServer = "localhost"
WMIObject = "winmgmts://" & strPrintServer
PrinterSet = GetObject(WMIObject).InstancesOf("win32_Printer")
For Each Printer In PrinterSet
MsgBox(Printer.Name & ": " & (Printer.PrinterStatus))
Next Printer
End Class
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim strPrintServer As String, WMIObject As String, PrinterSet As Object, Printer As Object
strPrintServer = "localhost"
WMIObject = "winmgmts://" & strPrintServer
PrinterSet = GetObject(WMIObject).InstancesOf("win32_Printer")
For Each Printer In PrinterSet
MsgBox(Printer.Name & ": " & (Printer.PrinterStatus))
Next Printer
End Class