M
Morten Fagermoen
Hi!
I use the code below to find the printers connected to the local computer.
How can I get the "Location" and "Description" information from the printers
I have connected?
Public Sub EnumerateConnectedPrinters(ByVal objECP As
System.Collections.Generic.List(Of String))
Dim strPrinter As String
Try
objECP.Clear()
For Each strPrinter In PrinterSettings.InstalledPrinters
'How can I find LOCATION and DESCRIPTION on a connected printer
If CBool(InStr(1, strPrinter, "\\",
Microsoft.VisualBasic.CompareMethod.Text)) Then
objECP.Add(Split(strPrinter, "\")(3) & "," &
Split(strPrinter, "\")(2) & ",,")
Else
objECP.Add(strPrinter & ",,,")
End If
Next strPrinter
Catch ex As Exception
'If bDebug Then Console.WriteLine("Error - Failed when disconnecting
network printers.")
logfile.WriteLine("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 "Description" information from the printers
I have connected?
Public Sub EnumerateConnectedPrinters(ByVal objECP As
System.Collections.Generic.List(Of String))
Dim strPrinter As String
Try
objECP.Clear()
For Each strPrinter In PrinterSettings.InstalledPrinters
'How can I find LOCATION and DESCRIPTION on a connected printer
If CBool(InStr(1, strPrinter, "\\",
Microsoft.VisualBasic.CompareMethod.Text)) Then
objECP.Add(Split(strPrinter, "\")(3) & "," &
Split(strPrinter, "\")(2) & ",,")
Else
objECP.Add(strPrinter & ",,,")
End If
Next strPrinter
Catch ex As Exception
'If bDebug Then Console.WriteLine("Error - Failed when disconnecting
network printers.")
logfile.WriteLine("Error - Failed to enumerate connected printers.")
logfile.Flush()
Finally
strPrinter = Nothing
End Try
End Sub
Regards
Morten Fagermoen