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

Printing Help

I am using a print preview dailog in vb .net and when I open the dialog there
are multiple pages. Everytime I press the print button only the last page
prints. I have tried so many things but can't seem to get it to work
properly. Can anyone help???

I posted a message earlier about this but from the reply I believe my code
is set up right. My print preview shows everything correctly, just wont
print right.
Below is a sample of some of my code.
Private Sub pdEarnings_PrintPage(ByVal sender As Object, ByVal ev As
System.Drawing.Printing.PrintPageEventArgs) Handles pdEarnings.PrintPage

On Error GoTo err_fill_report

cintCol1Start = 190
cintColWidth = 100
mfntPrint = New Font("Arial", 6)
msngFontHeight = mfntPrint.GetHeight(ev.Graphics)
msngYPos = 713
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "EMPLOYEE")

cintCol1Start = 350
cintColWidth = 100
msngYPos += mfntPrint.GetHeight(ev.Graphics)
mfntPrint = New Font("Arial", 5)
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "RATES")

cintCol1Start = 28
cintCol2Start = 70
cintCol3Start = 135
cintCol4Start = 270
cintCol5Start = 325
cintCol6Start = 365
cintColWidth = 100
msngYPos += mfntPrint.GetHeight(ev.Graphics)
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "BADGE")
Call DrawStringInBox(ev, cintCol2Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "DEPT")
Call DrawStringInBox(ev, cintCol3Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "EMPLOYEE NAME")
Call DrawStringInBox(ev, cintCol4Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "SHIFT")
Call DrawStringInBox(ev, cintCol5Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "BASE")
Call DrawStringInBox(ev, cintCol6Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "AVERAGE")
cintCol1Start = 495
cintColWidth = 300
mfntPrint = New Font("Arial", 9)
msngYPos = 713
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "LEAR CORPORATION CANADA LTD.")
cintCol1Start = 495
cintColWidth = 300
msngYPos += mfntPrint.GetHeight(ev.Graphics)
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "KITCHENER")
cintCol1Start = 495
cintColWidth = 300
mfntPrint = New Font("Arial", 9, FontStyle.Bold)
msngYPos = 760
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "EMPLOYEE DAILY STATEMENT OF EARNINGS")
'Production and payroll section Box 3
cintCol1Start = 125
cintCol2Start = 635
cintColWidth = 100
mfntPrint = New Font("Arial", 7, FontStyle.Bold)
msngYPos = 785
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "PRODUCTION ON")
Call DrawStringInBox(ev, cintCol2Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "PAYROLL")

cintCol1Start = 185
cintCol2Start = 250
cintCol3Start = 355
cintCol4Start = 400
cintCol5Start = 515
cintCol6Start = 610
cintCol7Start = 670
cintCol8Start = 770
cintColWidth = 200
mfntPrint = New Font("Arial", 5)
msngYPos = 800
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "REPORTED")
Call DrawStringInBox(ev, cintCol2Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "BADGED")
Call DrawStringInBox(ev, cintCol3Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "TEAM")
Call DrawStringInBox(ev, cintCol4Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "STANDARD")
Call DrawStringInBox(ev, cintCol5Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "EARNINGS")
Call DrawStringInBox(ev, cintCol6Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "SHIFT")
Call DrawStringInBox(ev, cintCol7Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "ADD")
Call DrawStringInBox(ev, cintCol8Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "GROSS")

cintCol1Start = 40
cintCol2Start = 150
cintCol3Start = 190
cintCol4Start = 255
cintCol5Start = 300
cintCol6Start = 355
cintCol7Start = 403
cintCol8Start = 460
cintCol9Start = 490
cintCol10Start = 545
cintCol11Start = 610
cintCol12Start = 670
cintCol13Start = 725
cintCol14Start = 772
cintColWidth = 200
msngYPos += mfntPrint.GetHeight(ev.Graphics)
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "PART NUMBER")
Call DrawStringInBox(ev, cintCol2Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "OP")
Call DrawStringInBox(ev, cintCol3Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "HRS.")
Call DrawStringInBox(ev, cintCol4Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "HRS.")
Call DrawStringInBox(ev, cintCol5Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "QUANTITY")
Call DrawStringInBox(ev, cintCol6Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "SIZE")
Call DrawStringInBox(ev, cintCol7Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "RATE")
Call DrawStringInBox(ev, cintCol8Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "BC")
Call DrawStringInBox(ev, cintCol9Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "REGULAR")
Call DrawStringInBox(ev, cintCol10Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "OVERTIME")
Call DrawStringInBox(ev, cintCol11Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "PREM.")
Call DrawStringInBox(ev, cintCol12Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "ON")
Call DrawStringInBox(ev, cintCol13Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "COLA")
Call DrawStringInBox(ev, cintCol14Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, "PAY")

If Me.mstrProdDateB3(y) <"" Then

'Print Production On Date in Box 3
cintCol1Start = 220
cintColWidth = 200
mfntPrint = New Font("Arial", 8, FontStyle.Bold)
msngYPos = 785
Call DrawStringInBox(ev, cintCol1Start, msngYPos, cintColWidth,
msngYPos + msngFontHeight, Me.mstrProdDateB3(y))

If Me.mblnRecdDetal3(y) = True Then
'Employee Section Details Box 3
cintCol1Start = 25
cintCol2Start = 70
cintCol3Start = 105
cintCol4Start = 265
cintCol5Start = 314
cintCol6Start = 370
cintColWidth = 250
mfntPrint = New Font("Arial", 11)
msngYPos = 755
Call DrawStringInBox(ev, cintCol1Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrBadgeB3(y))
Call DrawStringInBox(ev, cintCol2Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrDeptB3(y))
Call DrawStringInBox(ev, cintCol3Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrEmpNameB3(y))
Call DrawStringInBox(ev, cintCol4Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrShiftB3(y))
Call DrawStringInBox(ev, cintCol5Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblBaseB3(y).ToString("#.00"))
Call DrawStringInBox(ev, cintCol6Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblAverB3(y).ToString("#.00"))

'Production/payroll Section Details Box 3
cintCol1Start = 15
cintCol2Start = 43
cintCol3Start = 150
cintCol4Start = 17
cintCol5Start = 80
cintCol6Start = 135
cintCol7Start = 170
cintCol8Start = 230
cintCol9Start = 460
cintCol10Start = 328
cintCol11Start = 385
cintCol12Start = 435
cintCol13Start = 485
cintCol14Start = 550
cintCol15Start = 600
cintColWidth = 200
mfntPrint = New Font("Arial", 7, FontStyle.Regular)
msngYPos = 820
For z3 = startB3(y) To z3SaveB3(y)
Call DrawStringInBox(ev, cintCol1Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrExpB3(z3))
Call DrawStringInBox(ev, cintCol2Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrPartB3(z3))
If Me.mstrOperB3(z3) <"0" Then
Call DrawStringInBox(ev, cintCol3Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrOperB3(z3))
End If
Call DrawStringOutBox(ev, cintCol4Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblRptdHrsB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol5Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrBadgeHrsB3(z3))
If Me.mintQtyB3(z3) <0 Then
Call DrawStringOutBox(ev, cintCol6Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mintQtyB3(z3).ToString)
End If
Call DrawStringOutBox(ev, cintCol7Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mintTeamB3(z3).ToString)
Call DrawStringOutBox(ev, cintCol8Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblStandRateB3(z3).ToString("#.00"))
If Me.mstrDeptB3(y) <Me.mstrBCB3(z3) Then
Call DrawStringInBox(ev, cintCol9Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mstrBCB3(z3))
End If
Call DrawStringOutBox(ev, cintCol10Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblEarnRegB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol11Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblEarnOTB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol12Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblShftPremB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol13Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblAddOnB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol14Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblColaB3(z3).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol15Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblGrossPayB3(z3).ToString("#.00"))
msngYPos += mfntPrint.GetHeight(ev.Graphics)
Next (z3)
'print totals
cintCol1Start = 15
cintCol2Start = 17
cintCol3Start = 328
cintCol4Start = 385
cintCol5Start = 435
cintCol6Start = 485
cintCol7Start = 550
cintCol8Start = 600
mfntPrint = New Font("Arial", 7, FontStyle.Bold)
Call DrawStringInBox(ev, cintCol1Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, "TOTAL")
Call DrawStringOutBox(ev, cintCol2Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotRptHrsB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol3Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotRegEarnB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol4Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotOTEarnB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol5Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotShiftPremB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol6Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotAddOnB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol7Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, Me.mdblTotColaB3(y).ToString("#.00"))
Call DrawStringOutBox(ev, cintCol8Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight,
Me.mdblTotGrossB3(y).ToString("#.00"))

Else
cintCol1Start = 25
cintColWidth = 500
mfntPrint = New Font("Arial", 12, FontStyle.Bold)
msngYPos = 900
Call DrawStringInBox(ev, cintCol1Start, msngYPos,
cintColWidth, msngYPos + msngFontHeight, "NO EARNINGS FOR DATE SELECTED " &
Me.mstrProdDateB3(y))
End If

End If

If msngCurrentPage < msngPages Then
msngYPos = ev.MarginBounds.Top + (msngFontHeight * 5)
y += 1

msngCurrentPage += 1
ev.HasMorePages = True
Else
ev.HasMorePages = False

End If

err_fill_report:

End Sub

Mar 14 '07 #1
0 1180

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
0
by: DotNetDummy | last post by:
Hi all, I am trying to set the printing setting e.g duplex mode etc. on a default printer when I.E object started printing a particular html doc. Here's the partial code, any help would be...
5
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath =...
4
by: Arif | last post by:
I C# code prints very slow as compared to a third party barcode printing software. That software prints approximately 10 labels in 2 seconds while my C# code prints 10 labels in 5 to 6 seconds. And...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
2
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.