Hi,
I've browsed through all the threads I can find without success.
Is there a .NET equivalent of the VB6 code
VB Code:
Printer.Print "This is a test" Printer.EndDoc
Printable View
Hi,
I've browsed through all the threads I can find without success.
Is there a .NET equivalent of the VB6 code
VB Code:
Printer.Print "This is a test" Printer.EndDoc
Simple Printing Sample:
[Attached]
Hi ABX,
"Simple Printing Sample:"
I guess your Idea of "simple printing" differs radically from mine
:eek: :eek: :eek:
This is enough to send me back to VB6!
Does this mean there is no .NET equivalent of:
VB Code:
Printer.Print "This is a test" Printer.EndDoc
Unforuntately printing in .NET sucks. The next version has a MUCH better printing model, but for now this is about the closest thing:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pdoc As New Printing.PrintDocument AddHandler pdoc.PrintPage, AddressOf DoPrintPage pdoc.Print() RemoveHandler pdoc.PrintPage, AddressOf DoPrintPage End Sub Private Sub DoPrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) e.Graphics.DrawString("This is a test!", Me.Font, New SolidBrush(Color.Black), 10, 10) End Sub
Basically you draw what you want to print in the PrintPage event of a PrintDocument.
Hi Edneeis,
That's much easier:)
How can I prevent the page ejecting from the printer until I want it to? i.e. Allow printing several lines.
Many thanks,
Remember this:
open "LPT1:" for output as #1
print #1, "Hello Printer"
close #1
Happy days from a bygone era of dot matrix printers.
Hi,
"open "LPT1:" for output as #1
print #1, "Hello Printer"
close #1
"
Or even earlier
Echo:
I don't think you can. You'd have to do all your processing either before or during the event but I think it still calls EndDoc at the end of the PrintPage event.