473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HasMorePages = true doesn't let me jump to next page

Leo
I set HasMorePages to true, but it doesn't let me jump to next page.
(Of course, if I remove the HasMorePages = false in my if statement, it
will create hundreds of pages). Any suggestion? Thanks in advance.

Leo

My code to call the print event:

....
{
m_PrintDoc = new PrintDocument();
m_PrintDoc.PrintPage += new
PrintPageEventHandler(this.OnPrintPage);
m_PrintDoc.DefaultPageSettings.Landscape = false;
m_PrintDoc.DocumentName = "Wall Layout";

m_Preview = new PrintPreviewDialog();
((Form)m_Preview).WindowState = FormWindowState.Maximized;
m_Preview.Document = m_PrintDoc;
m_Preview.ShowDialog();
m_Preview.Dispose();

...
}

private void OnPrintPage(object sender,PrintPageEventArgs e)
{

ArrayList lumberList = m_Wall.GetLumberListBySize();
for (int i = 0; i < lumberList.Count; i++)
{
if (m_yPos > m_BottomMargin)
{
m_yPos = m_TopMargin;
e.HasMorePages = true;
}
else
e.HasMorePages = false;
...
}
}

Apr 19 '06 #1
2 7855
What do you mean "doesn't let [you] jump to the next page"? You're the
one who controls which page is printed when OnPrintPage is called. I
can't really tell from your code, but I'm guessing that the problem is
that you're getting the list of things to print and starting to loop
through it in your OnPrintPage method, so every time the method is
called you start again at the beginning.

You should do things like get the list of things to print and reset
your "loop" counter in OnBeginPrint. OnPrintPage should start printing
from where it left off last time it was called.

There is no magic "jump to next page"... you have to handle that
yourself.

Apr 19 '06 #2
"Leo" <pk*******@yahoo.com> ha scritto nel messaggio
news:11**********************@i40g2000cwc.googlegr oups.com...
I set HasMorePages to true, but it doesn't let me jump to next page.
(Of course, if I remove the HasMorePages = false in my if statement, it
will create hundreds of pages). Any suggestion? Thanks in advance.


e.HasMorePages just does what it means: tell if the document has more pages
to be printed.

When you exit from the method you reached the "jump to next page" (of cours,
if the document HasMorePages).
--

Free .Net Reporting Tool - http://www.neodatatype.net
Apr 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mr. B | last post by:
VB.net (standard) I'm experiencing some difficulties in printing multiple pages using Print Preview. The following is my main parts of my printing subs (excess info deleted for your viewing...
3
by: DGeorge | last post by:
I have a problem where after setting the HasMorePages = True will not print the 2nd Pages. Does anybody have an idea or knows this problem. Thanks for any advice
1
by: Kyle Walz | last post by:
I'm working on an app where each page is a like a form (not Windows form) with a set format. Using MSVB.NET 2003 with 1.1 framework. Here's some code: Private Sub PrintText(ByVal sender As...
0
by: Leo | last post by:
I set HasMorePages to true, but it doesn't let me jump to next page. (Of course, if I remove the HasMorePages = false in my if statement, it will create hundreds of pages). Any suggestion? Thanks...
1
by: kig25 | last post by:
Hello, When using the VB.NET PrintDocument class, I seem to be encountering an issue where the sub pd_PrintPage handles PrintDocument.PrintPage (upon continuing if HasMorePages = true) will...
6
by: moti | last post by:
Whenever I use PrintDocument.Print() to print a page it goes to PrintDocument_PrintPage and stays there forever unless I set e.HasMorePages to False. When I set it to False it prints the page but...
0
by: creedence | last post by:
Hello I have a problem with printing data from dataset.I dont know how to make that print is go on to the next page. I know that is something with hasmorepages = true but i dont Know how to use...
0
by: Scotty | last post by:
Hi, Hope someone can help me I have a datagridview sith data Code below works fine if I print the data if there is only 1 page (without using '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! If...
2
by: GGSoft | last post by:
Please Can't understand how to use HasMorepages. I spent a lot of time on this task. but I have no result. For examle I want to print every 45 record on each new page. Please Rewrite the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.