473,378 Members | 1,175 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.

First App: Need print preview in my program; cannot figure out page limits

1
Hi all,
Need i simple example on how print/preview data from a database.
I already have some code but I am lost because the preview does not create
multiple pages and only shows the first page and the printing goes over the
margins of the page. My problem is that I cannot figure out how to control
new page when page is getting full. Another problem is that I would like to
have a common place to set headers and footers to be printed every time a
new page is sent.

I would like to have a little code sample even with just printing lines.

This is part of the code that I am using with MySQL database just going thru
some records:

While datareader.Read()

e.Graphics.DrawString(datareader("upc").ToString, sfont, Brushes.Black,
lblpos(0) + 0.5, YPosition)

e.Graphics.DrawString(datareader("description").To String, sfont,
Brushes.Black, lblpos(1) + 0.5, YPosition)

e.Graphics.DrawString(datareader("onhand").ToStrin g, sfont, Brushes.Black,
lblpos(2) + 0.5, YPosition)

e.Graphics.DrawString(datareader("min").ToString, sfont, Brushes.Black,
lblpos(3) + 0.5, YPosition)

e.Graphics.DrawString(datareader("cost").ToString, sfont, Brushes.Black,
lblpos(4) + 0.5, YPosition)

e.Graphics.DrawString(datareader("price").ToString , sfont, Brushes.Black,
lblpos(5) + 0.5, YPosition)

CountLine += 1

YPosition = TopMargin + (CountLine * myFont.GetHeight(e.Graphics))

Console.WriteLine(">>>" & YPosition)

If CountLine = 20 Then

e.HasMorePages = False

CountLine = 1

Else

e.HasMorePages = True

End If

End While

datareader.Close()

Some of the code has been omitted.



Thanks,

-hb
Aug 29 '06 #1
0 1123

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bernard | last post by:
Hi, I have a problem with a CGI script (Perl) on a Win2000 server. The script is for sending E-cards and was written by Jason Maloney:...
4
by: Gary | last post by:
Hello, I'm hoping someone can shed some light on why my report does not output the same results as shown in preview mode, which is to move the position of a check box based on a field value (see...
1
by: Hector M Banda | last post by:
Hi all, Need i simple example on how print/preview data from a database. I already have some code but I am lost because the preview does not create multiple pages and only shows the first page and...
2
by: Gun Slinger | last post by:
Hi guys. I have a print preview control which I am making, as I have found the one that comes in the showdialogue to be fairly poor for what I needed. Anyway. I have at the moment all of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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...
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.