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

help with .HasMorePages and non-iterating printing

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 Object, ByVal ev As
PrintPageEventArgs)
Dim brush As Brush = New SolidBrush(Color.Black)
Dim font As Font = New Font("Arial", 10, FontStyle.Regular)

' first page
ev.Graphics.DrawString(Label1.Text, font, brush, 60, 60)
ev.Graphics.DrawString(TextBox1.Text, font, brush, 420, 60)
' etc...
ev.Graphics.DrawString(Label37.Text, font, brush, 60, 840)
ev.Graphics.DrawString(TextBox36.Text, font, brush, 420, 840)

' tried a few different things here, I know this doesn't work :)
ev.HasMorePages = False
ev.HasMorePages = True

' second page
ev.Graphics.DrawString(Label40.Text, font, brush, 280, 60)
ev.Graphics.DrawString(Label41.Text, font, brush, 480, 60)
' etc...
ev.Graphics.DrawString(TextBox49.Text, font, brush, 280, 570)
ev.Graphics.DrawString(Label54.Text, font, brush, 480, 570)

ev.HasMorePages = False
End Sub

Each page is different with various column-n-row setups. Looking for
a way to say "next page" and keep marching to a new page's format.
Thanks for any help.

Kyle
Nov 20 '05 #1
1 1463
(Haven't seen any replies yet, but updating progress.)
I have a gnarly (makes me feel dirty) workaround that'll do for
development. Please offer suggestions on a more elegant way to
accomplish multiple page printing.

//from print button action event
Dim result As DialogResult = PrintDialog1.ShowDialog()
If result = DialogResult.OK Then
For i = 1 To 2
PrintDoc.Print()
Next
End If

//printpage sub
Private Sub PrintText(ByVal sender As Object, _
ByVal ev As PrintPageEventArgs)
Dim brush As Brush = New SolidBrush(Color.Black)
Dim pen As New System.Drawing.Pen(System.Drawing.Color.Black)
Dim font As Font = New Font("Arial", 10, FontStyle.Regular)
Dim font1 As Font = New Font("Arial", 10, FontStyle.Bold)

' DrawString(string, brush, x, y)

If (i = 1) Then page_one(ev, brush, pen, font, font1)
If (i = 2) Then page_two(ev, brush, pen, font, font1)

End Sub

The ev.HasMorePages = False is at the end of each page_number() sub.
All the Graphics.DrawString calls are in the page_number subs to keep
everything tidy.

Thanks for any help.

Kyle
Nov 20 '05 #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...
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...
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...
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.