This is Windows Form code, but you can make it fit:
Imports System.Drawing.Printing
Public Class Form1
Inherits System.Windows.Forms.Form
'Windows Designer code
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim moReturn As
Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject
moSearch = New
Management.ManagementObjectSearcher("Select * from
Win32_Printer")
moReturn = moSearch.Get
'list all printers for this computer
For Each mo In moReturn
Debug.WriteLine(mo("Name"))
Next
'give the default printer name
Dim doc As PrintDocument = New PrintDocument
MessageBox.Show(doc.PrinterSettings.PrinterName)
End Sub
John Warner
> -----Original Message-----
> From: John [mailto:jmorcom blueyonder.co.uk]
> Sent: Thursday, July 19, 2007 4:19 PM
> To: aspnet aspadvice.com
> Subject: [aspnet] Printing to default printer
>
>
> Hi all,
>
> I'm trying to create a simple application in ASP.NET to
print
> receipts via a web page to the default printer. If the
> default printer is a network printer, it doesn't work,
but I
> can get it to work by using a specific printer name.
(example below)
>
>
>
> dim prtr as new Printing.PrintDocument
>
> prtr.printersettings.printername =
"\servernamePrintername"
>
>
>
> Be grateful for any ideas as to what I'm doing wrong
!!!
>
>
>
>
> --- List Settings ---
> http://aspadvice.com/list
s/
>
--- List Settings ---
http://aspadvice.com/list
s/
|