473,378 Members | 1,436 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,378 software developers and data experts.

e.hasmorepages???????????

hello all.....
I can currently print out only one page with the following code...(note it
lacks the e.hasmorepages=false)

Private Sub PrintToolStripButton_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles PrintToolStripButton.Click
'Print file from the ToolStrip
Me.PrintDialog1.ShowDialog()
PrintDocument1.Print()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
'Print Function to call
e.Graphics.DrawString(Me.RichTextBox1.Text, New Font("Courier New",
10, FontStyle.Regular), Brushes.Black, 0, 0)

End Sub

This prints out 1 pg and 1 pg only....regardless if there's more or not.

I searched dotnet.general for discussions on this subject and found out
about e.hasmorepages.....however, when I use it in my code the printpage
count thingy goes
crazy.....just multiplies (100 pages +) my printer don't like this :)

Can anyone shed any light on this for me? Maybe help me to print out exactly
how many pages I actually have and not 100's or just 1?

My code looks like this.....

Private Sub PrintToolStripButton_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles PrintToolStripButton.Click
'Print file from the ToolStrip
Me.PrintDialog1.ShowDialog()
PrintDocument1.Print()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
'Print Function to call
e.Graphics.DrawString(Me.RichTextBox1.Text, New Font("Courier New",
10, FontStyle.Regular), Brushes.Black, 0, 0)
e.HasMorePages = True
End Sub

Thank you much!!!!!!!!!

Brenton (long-winded) Garman
Apr 11 '06 #1
1 2402
You are responsible for telling PrintPage if you have any more pages to
print - by setting e.HasMorePages = True.

It won't do it for you - the same event gets called repeatedly each
time you set e.HasMorePages = True

It all depends on what you're trying to print out. It's normally a
case of working out how many pages there are based on the amount of
text/images you want to print and how they fit into the
PrintPageEventArgs.MarginBounds.

You can use PrintPageEventArgs.e.Graphics.MeasureString("text" , myFont)
to measure the size of a string in the selected font to see how big it
will be on the page.

The PrintDocument help has good sample.

Apr 11 '06 #2

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...
2
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.