Como saber las impresoras Instaladas
Como puedo saber que impresoras tengo instaladas en mi pc desde un WIndowsForms
de Antemano Gracias
de Antemano Gracias
Checa este codigo a ver si te sirve
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Printing
Public Class Form1
Inherits System.Windows.Forms.Form
Private comboBox1 As System.Windows.Forms.ComboBox
Private label1 As System.Windows.Forms.Label
Public Sub New()
comboBox1 = New ComboBox()
label1 = New Label()
label1.Location = New System.Drawing.Point(20, 10)
label1.Name = "label1"
label1.Size = New System.Drawing.Size(75, 20)
label1.Text = "Select Printer"
comboBox1.Location = New System.Drawing.Point(100, 10)
comboBox1.Name = "comboBox1"
comboBox1.Size = New System.Drawing.Size(150, 20)
AutoScaleBaseSize = New System.Drawing.Size(5, 13)
ClientSize = New System.Drawing.Size(300, 100)
Text = "Printers Sample"
Controls.AddRange(New System.Windows.Forms.Control() {Me.label1, Me.comboBox1})
Me.Load += New System.EventHandler(Me.Form1_Load)
End Sub 'New
Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
Private Sub Form1_Load(sender As Object, e As System.EventArgs)
Dim prtdoc As New PrintDocument()
Dim strDefaultPrinter As String = prtdoc.PrinterSettings.PrinterName
Dim strPrinter As [String]
For Each strPrinter In PrinterSettings.InstalledPrinters
comboBox1.Items.Add(strPrinter)
If strPrinter = strDefaultPrinter Then
comboBox1.SelectedIndex = comboBox1.Items.IndexOf(strPrinter)
End If
Next strPrinter
End Sub 'Form1_Load
End Class 'Form1
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Printing
Public Class Form1
Inherits System.Windows.Forms.Form
Private comboBox1 As System.Windows.Forms.ComboBox
Private label1 As System.Windows.Forms.Label
Public Sub New()
comboBox1 = New ComboBox()
label1 = New Label()
label1.Location = New System.Drawing.Point(20, 10)
label1.Name = "label1"
label1.Size = New System.Drawing.Size(75, 20)
label1.Text = "Select Printer"
comboBox1.Location = New System.Drawing.Point(100, 10)
comboBox1.Name = "comboBox1"
comboBox1.Size = New System.Drawing.Size(150, 20)
AutoScaleBaseSize = New System.Drawing.Size(5, 13)
ClientSize = New System.Drawing.Size(300, 100)
Text = "Printers Sample"
Controls.AddRange(New System.Windows.Forms.Control() {Me.label1, Me.comboBox1})
Me.Load += New System.EventHandler(Me.Form1_Load)
End Sub 'New
Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
Private Sub Form1_Load(sender As Object, e As System.EventArgs)
Dim prtdoc As New PrintDocument()
Dim strDefaultPrinter As String = prtdoc.PrinterSettings.PrinterName
Dim strPrinter As [String]
For Each strPrinter In PrinterSettings.InstalledPrinters
comboBox1.Items.Add(strPrinter)
If strPrinter = strDefaultPrinter Then
comboBox1.SelectedIndex = comboBox1.Items.IndexOf(strPrinter)
End If
Next strPrinter
End Sub 'Form1_Load
End Class 'Form1
