1 Replies - 5104 Views - Last Post: 15 October 2008 - 12:09 AM Rate Topic: -----

#1 sadanandam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 14-October 08

how to connect the different printers through vb.net

Post icon  Posted 14 October 2008 - 02:36 AM

Hi,
I need to connect the different printers in network through vb.net 2005, can you please help how connect the diffrent printers in network.


Thanks
Sadanandam
Is This A Good Question/Topic? 0
  • +

Replies To: how to connect the different printers through vb.net

#2 ThatOtherGuy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 13-October 08

Re: how to connect the different printers through vb.net

Posted 15 October 2008 - 12:09 AM

Hi,

Sorry but i dont really know what it is you are looking for, but here is some code on how to get a list of the printers installed on a machine.

  Private Sub frmPrinterSelection_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim i As Integer
    Dim ioPrinter As Integer
    Dim found As Boolean = False

    'Add this computers avail printers to the combobox
    cbbPrinters.Items.Clear()
    For i = 0 To (Printing.PrinterSettings.InstalledPrinters.Count - 1)
      cbbPrinters.Items.Add(Printing.PrinterSettings.InstalledPrinters.Item(i))

      'Check to see if there is a IO Printer in the list
      If InStr(Printing.PrinterSettings.InstalledPrinters.Item(i), "IO PRINTER") Then
        ioPrinter = i
        found = True
      End If
    Next

    'There is a problem with the printer at sales this makes them choose the printer
    'found = False

    'If the IO printer is found on the users machine use as default and print automatical
    'If not display the print form and let the user select the printer
    If found Then
      'Set the default printer to be the printer being used to print to
      frmPlaceOrder.ioDoc.PrinterSettings.PrinterName = "IO PRINTER"

      Try
        frmPlaceOrder.ioDoc.Print()

        'Close the form if printing to the default printer
        Me.Close()
        Exit Sub
      Catch ex As Exception
        MsgBox(ex.Message, MsgBoxStyle.Critical, "Printing Error")
      End Try
    End If

    cbbPrinters.Focus()
  End Sub



Hope this help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1