|
-
Mar 21st, 2004, 01:31 PM
#1
Thread Starter
PowerPoster
Simple Line Print
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
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 21st, 2004, 02:42 PM
#2
Simple Printing Sample:
[Attached]
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Mar 21st, 2004, 07:38 PM
#3
Thread Starter
PowerPoster
Hi ABX,
"Simple Printing Sample:"
I guess your Idea of "simple printing" differs radically from mine
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
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 21st, 2004, 07:49 PM
#4
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.
-
Mar 22nd, 2004, 05:45 AM
#5
Thread Starter
PowerPoster
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,
Last edited by taxes; Mar 22nd, 2004 at 05:48 AM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 22nd, 2004, 10:37 AM
#6
Remember this:
open "LPT1:" for output as #1
print #1, "Hello Printer"
close #1
Happy days from a bygone era of dot matrix printers.
I don't live here any more.
-
Mar 22nd, 2004, 06:03 PM
#7
Thread Starter
PowerPoster
Hi,
"open "LPT1:" for output as #1
print #1, "Hello Printer"
close #1
"
Or even earlier
Echo:
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 22nd, 2004, 10:50 PM
#8
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|