|
-
Sep 9th, 2003, 04:24 PM
#1
Thread Starter
New Member
How do I print multiple pages?
I can get my printing to work in VB.net, except for one problem, I can't print multiple pages that are different. eg, continut in order from the overflow of the previouse page.
cause when I insert this code:
_____________________________
g.DrawString("Current Trade Data", Me.Font, Brushes.Black, 30 * scalex, 30 * scaley, New StringFormat())
g.DrawString("Options", Me.Label36.Font, Brushes.Black, 100 * scalex, 50 * scaley, New StringFormat())
g.DrawString("QUANTITY", Me.Font, Brushes.Black, 30 * scalex, 70 * scaley, New StringFormat())
g.DrawString("PRICE", Me.Font, Brushes.Black, 100 * scalex, 70 * scaley, New StringFormat())
g.DrawString("MtoM", Me.Font, Brushes.Black, 170 * scalex, 70 * scaley, New StringFormat())
g.DrawString("Cumulative", Me.Font, Brushes.Black, 240 * scalex, 70 * scaley, New StringFormat())
g.DrawString("BookingFee", Me.Font, Brushes.Black, 310 * scalex, 70 * scaley, New StringFormat())
g.DrawString("STRIKE_PRICE", Me.Font, Brushes.Black, 380 * scalex, 70 * scaley, New StringFormat())
g.DrawString("Con_TYPE", Me.Font, Brushes.Black, 450 * scalex, 70 * scaley, New StringFormat())
Dim ia, ib As Integer
Dim ll, tt As Short
For ia = 0 To contractOptions.Rows.Count - 1
For ib = 0 To contractOptions.Columns.Count - 1
ll = ((ib * 70) + 30) * scalex
tt = (((ia * 20) + 90) * scaley)
If (page * (560 * scaley)) < tt Then
ev.HasMorePages = True
page = page + 1
Else
ev.HasMorePages = False
End If
g.DrawString(ConDataGrid.Item(ia, ib), Me.Font, Brushes.Black, ll, tt, New StringFormat())
Next ib
Next ia
_____________________________
It just prints multiple pages of the same page.
I get the information out a data set.
-
Sep 9th, 2003, 08:08 PM
#2
I wonder how many charact
It prints the same information, because all it will do, is call the _PrintPage event again.
For example...
VB Code:
Public Sub PrintDoc_PrintPage
g.drawString("HI")
If (page * (560 * scaley)) < tt Then
ev.HasMorePages = True
page = page + 1
Else
ev.HasMorePages = False
End If
End Sub
Now obviously, it does you no good to keep printing the same stuff again. So you have to devise a way to keep track of what rows have been printed. You can use a higher-scope variable (one that persists outside of _PrintPage sub, that retains the last row of the dataset printed. Then, when PrintPage is called again, it starts printing from the next row, instead of the first row.
-
Sep 10th, 2003, 01:16 PM
#3
Thread Starter
New Member
I will try that, that is just a small piece of code in a huge nested loops of while, if, and for statements, so it will be kinda tricky.
But I will keep it in mind.
Thanks a lot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|