I have my code to the point where I see the information on the print preview, but when it prints it is only printing the last line of the page. Any ideas of what I need to fix to get it to print all the information contained? I am new to this so I am not sure what needs to be added or changed. Here is the print section of my code.

Private Sub Button1PrintReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintReport.Click
            msngInitialValue = Convert.ToSingle(txtInitialValue.Text)
            msngSalvageValue = Convert.ToSingle(txtSalvageValue.Text)
            mintAssetLife = Convert.ToInt32(txtAssetLife.Text)
            msngTotalDepreciation = msngInitialValue - msngSalvageValue
            msngAnnualDepreciation = msngTotalDepreciation / mintAssetLife
            msngCurrentValue = msngInitialValue
            msngPage = 1
            mintCurrentYear = 1

        End Sub

        Private Sub PrintPreviewDialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ppddepreciationDialog1.Load

        End Sub

        Private Sub ppddepreciation_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles ppddepreciation.PrintPage

            Dim pintLinesPerPage As Integer ' Number of detail lines to print on a page.
            Dim pintTotalLines As Integer ' Total number of lines to print.
            Dim pintCurrentLine As Integer ' Current line number on current page.

            ' Print the page title.

            Call PrintPageTitles(e)

            ' Divide page height by height of a line to determine number of lines.

            ' Subtract 6 lines from this intermediate value to account for the

            ' page headings.

            pintLinesPerPage = Convert.ToInt32((e.MarginBounds.Height / msngFontHeight)) - 6
            pintTotalLines = mintAssetLife

            ' Calculate the total number of pages to print.

            msngPages = Convert.ToSingle(pintTotalLines / pintLinesPerPage + 1)

            ' Test to determine whether there are more pages to print. 

            If msngPage <= msngPages Then

                msngYPos = e.MarginBounds.Top + (msngFontHeight * 5)

                ' The For loop prints detail lines on the page

                For pintCurrentLine = 1 To pintLinesPerPage

                    msngYPos += mfntPrint.GetHeight(e.Graphics)
                    Call DrawStringInBox(e, cintCol1Start, msngYPos, _
                           cintColWidth, msngYPos + msngFontHeight, _

                    ' Print column 2 - 

                    Call DrawStringInBox(e, cintCol2Start, msngYPos, _
                    cintColWidth, msngYPos + msngFontHeight, _

                    ' Print column 3 - 

                    Call DrawStringInBox(e, cintCol3Start, msngYPos, _
                    cintColWidth, msngYPos + msngFontHeight, _
                    msngCurrentValue -= msngAnnualDepreciation

                    ' Print column 4 -

                    Call DrawStringInBox(e, cintCol4Start, msngYPos, _
                    cintColWidth, msngYPos + msngFontHeight, _
                    mintCurrentYear += 1

                    ' If the balance is less than 0, then all lines have

                    ' been printed. Print the total interest, set

                    ' HasMorePages to False, and then exit the event handler.

                    If msngCurrentValue <= msngSalvageValue Then

                        e.HasMorePages = False
                        Exit Sub
                    End If
                e.HasMorePages = True
            End If
        End Sub

    Function SLN( _
               ByVal Cost As Double, _
               ByVal Salvage As Double, _
               ByVal Life As Double _
               ) As Double
    End Function

End Class
8 Years
Discussion Span
Last Post by zwench

The rest of my application works beautifully except for the printed version not printing what is on the print preview. Any suggestions are appreciated.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.