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
I don't think he's trying to set a printer's status because he seems to be wanting to retrieve the status of a specific printer.
However, I don't understand his question:
How to I set the status of a Pinter as a variable?
Are you asking how to make a variable that holds the status of a printer?
EDIT: Actually, I think you have a printer object stored somewhere and all you're trying to do is update that object with the new status, right? If that's the case...just don't use Win32_Printer. Create your own printer class and update the fields on that.
if I read the OP right I think what they want is something kind of like this:
ideally to get "printer status events" in their application so that they can then react to changes in the current status of a printer.
polling wmi with a background worker is one way.....
I have had mixed results with some of the wmi calls.
I forget at the moment but some things in WMI are not very good, some are ok but some things are not well implemented.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.