Hi!
I use the code below to find the printers connected to the local computer.
How can I get the "Location" and "Descriptio n" information from the printers
I have connected?
Public Sub EnumerateConnec tedPrinters(ByV al objECP As
System.Collecti ons.Generic.Lis t(Of String))
Dim strPrinter As String
Try
objECP.Clear()
For Each strPrinter In PrinterSettings .InstalledPrint ers
'How can I find LOCATION and DESCRIPTION on a connected printer
If CBool(InStr(1, strPrinter, "\\",
Microsoft.Visua lBasic.CompareM ethod.Text)) Then
objECP.Add(Spli t(strPrinter, "\")(3) & "," &
Split(strPrinte r, "\")(2) & ",,")
Else
objECP.Add(strP rinter & ",,,")
End If
Next strPrinter
Catch ex As Exception
'If bDebug Then Console.WriteLi ne("Error - Failed when disconnecting
network printers.")
logfile.WriteLi ne("Error - Failed to enumerate connected printers.")
logfile.Flush()
Finally
strPrinter = Nothing
End Try
End Sub
Regards
Morten Fagermoen
I use the code below to find the printers connected to the local computer.
How can I get the "Location" and "Descriptio n" information from the printers
I have connected?
Public Sub EnumerateConnec tedPrinters(ByV al objECP As
System.Collecti ons.Generic.Lis t(Of String))
Dim strPrinter As String
Try
objECP.Clear()
For Each strPrinter In PrinterSettings .InstalledPrint ers
'How can I find LOCATION and DESCRIPTION on a connected printer
If CBool(InStr(1, strPrinter, "\\",
Microsoft.Visua lBasic.CompareM ethod.Text)) Then
objECP.Add(Spli t(strPrinter, "\")(3) & "," &
Split(strPrinte r, "\")(2) & ",,")
Else
objECP.Add(strP rinter & ",,,")
End If
Next strPrinter
Catch ex As Exception
'If bDebug Then Console.WriteLi ne("Error - Failed when disconnecting
network printers.")
logfile.WriteLi ne("Error - Failed to enumerate connected printers.")
logfile.Flush()
Finally
strPrinter = Nothing
End Try
End Sub
Regards
Morten Fagermoen
Comment