473,659 Members | 3,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
PrintPageEventA rgs)
Dim brush As Brush = New SolidBrush(Colo r.Black)
Dim font As Font = New Font("Arial", 10, FontStyle.Regul ar)

' first page
ev.Graphics.Dra wString(Label1. Text, font, brush, 60, 60)
ev.Graphics.Dra wString(TextBox 1.Text, font, brush, 420, 60)
' etc...
ev.Graphics.Dra wString(Label37 .Text, font, brush, 60, 840)
ev.Graphics.Dra wString(TextBox 36.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.Dra wString(Label40 .Text, font, brush, 280, 60)
ev.Graphics.Dra wString(Label41 .Text, font, brush, 480, 60)
' etc...
ev.Graphics.Dra wString(TextBox 49.Text, font, brush, 280, 570)
ev.Graphics.Dra wString(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 1475
(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.Sh owDialog()
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 PrintPageEventA rgs)
Dim brush As Brush = New SolidBrush(Colo r.Black)
Dim pen As New System.Drawing. Pen(System.Draw ing.Color.Black )
Dim font As Font = New Font("Arial", 10, FontStyle.Regul ar)
Dim font1 As Font = New Font("Arial", 10, FontStyle.Bold)

' DrawString(stri ng, 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.DrawSt ring 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
2890
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 pleasure). For a single page, the print preview (and an actual print) are OK. Getting the .HasMorePages doesn't seem to be working for me here (unless I'm missing something).
8
9871
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 pleasure). For a single page, the print preview (and an actual print) are OK. Getting the .HasMorePages doesn't seem to be working for me here (unless I'm missing something).
8
249
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 pleasure). For a single page, the print preview (and an actual print) are OK. Getting the .HasMorePages doesn't seem to be working for me here (unless I'm missing something).
2
7898
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 in advance. Leo My code to call the print event: .... {
0
1234
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 in advance. Leo My code to call the print event: .... {
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.