Dim sngXVal As Single
Dim sngYVal As Single
Dim intIncrement As Integer
Dim strOutput As String
Dim headingFont As New Font("Arial", 28, FontStyle.Bold)
Dim mainFont As New Font("Times New Roman", 12, FontStyle.Regular)
Dim subSectionFont As New Font("Arial", 22, FontStyle.Bold)
Dim blackPen As New Pen(Color.Black, 3)
Dim intCounter As Integer
sngXVal = e.MarginBounds.Left
sngYVal = e.MarginBounds.Top
e.Graphics.DrawRectangle(blackPen, e.PageBounds.Left + 100, _
e.PageBounds.Top + 100, e.PageBounds.Right - 200, _
e.PageBounds.Bottom - 200)
sngXVal += 10
sngYVal += 10
e.Graphics.DrawString("Your Transaction History", headingFont, Brushes.Black, _
(sngXVal + 30), sngYVal)
sngYVal += 90
sngXVal += 10
e.Graphics.DrawString("Account Details", subSectionFont, Brushes.Black, _
sngXVal, sngYVal)
sngYVal += 32
e.Graphics.DrawString("Account Number: ", mainFont, _
Brushes.Black, sngXVal, sngYVal)
e.Graphics.DrawString(CStr(mySavingsAccount.AccountNumber), mainFont, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Account Name: ", mainFont, _
Brushes.Black, sngXVal, sngYVal)
e.Graphics.DrawString(mySavingsAccount.AccountName, mainFont, Brushes.Black, _
(sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Bank Name: ", mainFont, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString(mySavingsAccount.BankName, mainFont, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Branch Number: ", mainFont, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString(CStr(mySavingsAccount.BranchNumber), mainFont, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Opening Balance: ", mainFont, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString(CStr(mySavingsAccount.OpeningBalance), mainFont, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Closing Balance: ", mainFont, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString(CStr(mySavingsAccount.ClosingBalance), mainFont, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Minimum Transaction: ", mainFont, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString(CStr(mySavingsAccount.TransactionMinimumBalance), _
mainFont, Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 45
e.Graphics.DrawString("Transactions", subSectionFont, Brushes.Black, _
sngXVal, sngYVal)
sngYVal += 32
mySavingsAccount.PrintTransactions(sender, e, mainFont, sngXVal, sngYVal)
Then in the savings Account Sub:
Public Sub PrintTransactions(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs, _
ByVal font As Font, ByVal sngXVal As Single, ByVal sngYVal As Single)
Dim intPass As Integer
Dim intIndex As Integer
Dim datBuffer As Date
For intPass = 1 To RecordTransaction.GetUpperBound(0)
For intIndex = 0 To RecordTransaction.GetUpperBound(0) - 1
If RecordTransaction(intIndex).TransactionDate > RecordTransaction(intIndex + 1).TransactionDate Then
datBuffer = RecordTransaction(intIndex).TransactionDate
RecordTransaction(intIndex).TransactionDate = RecordTransaction(intIndex + 1).TransactionDate
RecordTransaction(intIndex + 1).TransactionDate = datBuffer
End If
Next
Next
Dim intCounter As Integer
For intCounter = (RecordTransaction.GetLowerBound(0)) To (RecordTransaction.GetUpperBound(0))
e.Graphics.DrawString("Account Type: ", font, Brushes.Blue, sngXVal, _
sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).AccType), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Transaction Type: ", font, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).TransactionType), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Transaction Description: ", font, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).TransactionDescription), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Amount: ", font, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).Amount), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Date: ", font, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).TransactionDate), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 20
e.Graphics.DrawString("Indicator: ", font, Brushes.Black, _
sngXVal, sngYVal)
e.Graphics.DrawString((RecordTransaction(intCounter).Indicator), font, _
Brushes.Black, (sngXVal + 200), sngYVal)
sngYVal += 32
Next intCounter
End Sub