I want to get all the printers installed or connected to the PC in dropdownlist
.
I've done the following code for that.
Public Function FillddlPrinters() As Boolean
Dim printersettings As New System.Drawing.Printing.PrinterSettings
Dim Cnt As Integer = 0
Me.ddlPrinter.Items.Clear()
For i = 0 To Drawing.Printing.PrinterSettings.InstalledPrinters.Count - 1
If Drawing.Printing.PrinterSettings.InstalledPrinters(i).ToString.ToUpper.Trim.Contains("XPS") Or _
Drawing.Printing.PrinterSettings.InstalledPrinters(i).ToString.ToUpper.Trim.Contains("FAX") Or _
Drawing.Printing.PrinterSettings.InstalledPrinters(i).ToString.ToUpper.Trim.Contains("PDF") Then
Continue For
End If
Me.ddlPrinter.Items.Insert(Cnt, Drawing.Printing.PrinterSettings.InstalledPrinters(i))
Cnt += 1
Next
Me.ddlPrinter.Items.Insert(0, "Select Printer")
End Function
But it's not giving me all the printers. I'm not getting where it is going wrong.
The printer which is not displaying is on the network. And I'm successfully connected to the network. But though it is not getting displayed.
Meanwhile it is working ok on other machine in different network. Than why not on mine??
Please help me out with this.