By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

HOW to print more page using PrintPreviewDialig??

P: n/a
Hi all,

I want to use a printDocument and PrintPreviewDailog to
print more pages.

I can view more pages in printPreviewDialog, but I click a
print button, it only print a last page.

my code here...
Dim PrintInv as new PrintDocument()
AddHandler PrintInv.PrintPage, AddressOf printInvoice
PrintInv.PrinterSettings.PrintRange = PrintRange.AllPages

PreInvDialog.Document = PrintInv

PreInvDialog.ShowDialog()

If PreInvDialog.ShowDialog() = DialogResult.OK Then
Me.PrintInv.Print()
End If

Thanks,
KWOK
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello,

"KWOK" <k_*****@hotmail.com> schrieb:
I want to use a printDocument and PrintPreviewDailog to
print more pages.


http://www.mvps.org/dotnet/dotnet/samples/printing/
-> "PrintFramework"

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

P: n/a
To me it looks like there is some problem in your printInvoice function. Are
you managing HasMorePages variable properly ? Please post code for further
assistence and also are you initialising the varaible you are using to keep
track of printed page number when you have printed the last page ?

Note that Preview also causes PrintPage event to be called.

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:ud****************@TK2MSFTNGP12.phx.gbl...
Hello,

"KWOK" <k_*****@hotmail.com> schrieb:
I want to use a printDocument and PrintPreviewDailog to
print more pages.


http://www.mvps.org/dotnet/dotnet/samples/printing/
-> "PrintFramework"

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #3

P: n/a
KWOK,
This sounds like you are not properly positioning the data stream (or
whatever other item contains you data) in OnBeginPrint so that the starting
pointer is left at the last position produced by PrintPreview. Your
printing logic should reset the position and allocate disposable objects in
OnBeginPrint and (of course) deallocate resouces in OnEndPrint.

Ron Allen
"KWOK" <k_*****@hotmail.com> wrote in message
news:80****************************@phx.gbl...
Hi all,

I want to use a printDocument and PrintPreviewDailog to
print more pages.

I can view more pages in printPreviewDialog, but I click a
print button, it only print a last page.

my code here...
Dim PrintInv as new PrintDocument()
AddHandler PrintInv.PrintPage, AddressOf printInvoice
PrintInv.PrinterSettings.PrintRange = PrintRange.AllPages

PreInvDialog.Document = PrintInv

PreInvDialog.ShowDialog()

If PreInvDialog.ShowDialog() = DialogResult.OK Then
Me.PrintInv.Print()
End If

Thanks,
KWOK

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.