-
Nov 14th, 2013, 04:05 AM
#1
Thread Starter
Junior Member
Please help! Code behind for Print
Hi,
I have a report that I need to print after a sale has completed. I am having issues with the length and printing when using PrintForm and PrintDocument components however if I right click and select Print from the list the report prints perfectly. Is there any way that I could write code in my form load event that would imitate the right click print?
Ive been struggling with this part of my project for ages now and the whole thing is now way behind schedule.
Any help would be greatly appreciated.
Thanks!
-
Nov 14th, 2013, 05:11 AM
#2
Member
Re: Please help! Code behind for Print
Please post the code you are having problems with so we can try to assist. Thanks
~ TheMeq ~
If I helped in anyway, please hit the star and send me some rep! Thanks
-
Nov 14th, 2013, 05:14 AM
#3
Thread Starter
Junior Member
Re: Please help! Code behind for Print
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
With Me.PrintForm1
.PrintAction = Printing.PrintAction.PrintToPrinter
Dim MyMargins As New Margins
With MyMargins
.Left = 0
.Right = 0
.Top = 0
.Bottom = 0
End With
.PrinterSettings.DefaultPageSettings.Margins = MyMargins
.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)
End With
-
Nov 14th, 2013, 09:32 AM
#4
Re: Please help! Code behind for Print
-
Nov 14th, 2013, 09:40 AM
#5
Thread Starter
Junior Member
Re: Please help! Code behind for Print
I know that but what im asking is for help on coding right click and print?
thanks
-
Dec 24th, 2013, 05:26 AM
#6
Registered User
Re: Please help! Code behind for Print
use the following code, it helps you to print the invoice to printer directly
Dim rptSalesPF As New rptSalesPrintedForm
Dim doc As New Drawing.Printing.PrintDocument
doc.PrinterSettings.PrinterName = prnName
rptSalesPF.PrintOptions.PrinterName = prnName
rptSalesPF.PrintOptions.CustomPaperSource = doc.PrinterSettings.PaperSources.Item(tray)
rptSalesPF.PrintToPrinter(1, False, 0, 0)
hope this will help you
-
Dec 24th, 2013, 05:44 AM
#7
Thread Starter
Junior Member
Re: Please help! Code behind for Print
Thanks for your reply. I'll try it and let you know.
thanks
Kerrie
Tags for this Thread
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
|