I need someone to look over this and see what I am doing wrong. I keepgetting errors on this part of the code. It says its not defined.I also think i need to take that splitter thing out. I am new to all of this and haven't a clue how to fix it. Any help to give me some insight into what I am doing wrong is appreciated.
msngInitialValue = ToSingle(txtInitialValue.Text)
msngSalvageValue = ToSingle(txtSalvageValue.Text)
mintAssetLife = ToInt32(txtAssetLife.Text)
___________________________________________________
Option Strict On
Option Explicit On
Public Class frmmain
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
Friend WithEvents PrintPreviewDialog1 As System.Windows.Forms.PrintPreviewDialog
Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmmain))
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Splitter1 = New System.Windows.Forms.Splitter
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument
Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog
Me.PrintDialog1 = New System.Windows.Forms.PrintDialog
Me.SuspendLayout()
'
'Label1
'
Me.Label1.BackColor = System.Drawing.SystemColors.ControlLightLight
Me.Label1.Location = New System.Drawing.Point(80, 80)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(112, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Initial Value :"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.ControlLightLight
Me.Label2.Location = New System.Drawing.Point(80, 112)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(112, 16)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Asset Life :"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label3
'
Me.Label3.BackColor = System.Drawing.SystemColors.ControlLightLight
Me.Label3.Location = New System.Drawing.Point(80, 144)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(112, 16)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Salvage Value :"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(200, 80)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 20)
Me.TextBox1.TabIndex = 3
Me.TextBox1.Text = ""
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(200, 112)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(120, 20)
Me.TextBox2.TabIndex = 4
Me.TextBox2.Text = ""
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'TextBox3
'
Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox3.Location = New System.Drawing.Point(200, 144)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(120, 20)
Me.TextBox3.TabIndex = 5
Me.TextBox3.Text = ""
Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'Splitter1
'
Me.Splitter1.Location = New System.Drawing.Point(0, 0)
Me.Splitter1.Name = "Splitter1"
Me.Splitter1.Size = New System.Drawing.Size(3, 238)
Me.Splitter1.TabIndex = 6
Me.Splitter1.TabStop = False
'
'Button1
'
Me.Button1.Enabled = CType(configurationAppSettings.GetValue("Button1.Enabled", GetType(System.Boolean)), Boolean)
Me.Button1.Location = New System.Drawing.Point(408, 88)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 24)
Me.Button1.TabIndex = 7
Me.Button1.Text = "Print Report"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(408, 144)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(112, 24)
Me.Button2.TabIndex = 8
Me.Button2.Text = "Exit"
'
'PrintDocument1
'
Me.PrintDocument1.DocumentName = CType(configurationAppSettings.GetValue("Button1.Enabled", GetType(System.String)), String)
Me.PrintDocument1.OriginAtMargins = CType(configurationAppSettings.GetValue("PrintDocument1.OriginAtMargins", GetType(System.Boolean)), Boolean)
'
'PrintPreviewDialog1
'
Me.PrintPreviewDialog1.AutoScrollMargin = New System.Drawing.Size(0, 0)
Me.PrintPreviewDialog1.AutoScrollMinSize = New System.Drawing.Size(0, 0)
Me.PrintPreviewDialog1.ClientSize = New System.Drawing.Size(400, 300)
Me.PrintPreviewDialog1.Document = Me.PrintDocument1
Me.PrintPreviewDialog1.Enabled = True
Me.PrintPreviewDialog1.Icon = CType(resources.GetObject("PrintPreviewDialog1.Icon"), System.Drawing.Icon)
Me.PrintPreviewDialog1.Location = New System.Drawing.Point(23, 23)
Me.PrintPreviewDialog1.MinimumSize = New System.Drawing.Size(375, 250)
Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"
Me.PrintPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty
Me.PrintPreviewDialog1.Visible = False
'
'PrintDialog1
'
Me.PrintDialog1.AllowPrintToFile = CType(configurationAppSettings.GetValue("PrintDialog1.AllowPrintToFile", GetType(System.Boolean)), Boolean)
Me.PrintDialog1.AllowSelection = CType(configurationAppSettings.GetValue("PrintDialog1.AllowSelection", GetType(System.Boolean)), Boolean)
Me.PrintDialog1.AllowSomePages = CType(configurationAppSettings.GetValue("PrintDialog1.AllowSomePages", GetType(System.Boolean)), Boolean)
Me.PrintDialog1.Document = Me.PrintDocument1
Me.PrintDialog1.PrintToFile = CType(configurationAppSettings.GetValue("PrintDialog1.PrintToFile", GetType(System.Boolean)), Boolean)
Me.PrintDialog1.ShowHelp = CType(configurationAppSettings.GetValue("PrintDialog1.ShowHelp", GetType(System.Boolean)), Boolean)
'
'frmmain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.ActiveBorder
Me.ClientSize = New System.Drawing.Size(610, 238)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Splitter1)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Name = "frmmain"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Depreciation Schedule"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub frmmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Const cintCol1Start As Integer = 100
Private Const cintCol2Start As Integer = 250
Private Const cintCol3Start As Integer = 400
Private Const cintCol4Start As Integer = 550
Private Const cintColWidth As Integer = 170
Private mintAssetLife As Integer
Private msngInitialValue As Single
Private msngSalvageValue As Single
Private mintCurrentYear As Integer
Private msngTotalDepreciation As Single
Private msngAnnualDepreciation As Single
Private msngCurrentValue As Single
Private msngPage As Single
Private msngPages As Single
Private msngYPos As Single
Private msngFontHeight As Single
Private mfntPrint As Font
Private Sub PrintPageTitles(ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
Dim penLine As Pen = New Pen(Brushes.Black)
Dim recCurrent As RectangleF
Dim sfCurrent As New StringFormat
ev.Graphics.DrawRectangle(penLine, _
ev.PageBounds.Left + 100, _
ev.PageBounds.Top + 100, _
ev.PageBounds.Right - 200, _
ev.PageBounds.Bottom - 200)
mfntPrint = New Font("Arial", 14)
msngYPos = ev.MarginBounds.Top + _
(2 * mfntPrint.GetHeight(ev.Graphics))
recCurrent = New RectangleF(ev.MarginBounds.Left, _
ev.MarginBounds.Top, ev.MarginBounds.Right - 100, _
msngYPos)
sfCurrent.Alignment = StringAlignment.Center
ev.Graphics.DrawString("Depreciation Schedule", _
mfntPrint, Brushes.Black, recCurrent, sfCurrent)
mfntPrint = New Font("Arial", 10)
msngFontHeight = mfntPrint.GetHeight(ev.Graphics)
msngYPos += msngFontHeight
End Sub
Private Sub DrawStringInBox(ByVal ev As System.Drawing.Printing.PrintPageEventArgs, _
ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, _
ByVal s As String)
Dim sfCurrent As New StringFormat
Dim recCurrent As New RectangleF(x1, y1, x2, y2)
sfCurrent.Alignment = StringAlignment.Far
msngCurrentValue -= msngAnnualDepreciation
ev.Graphics.DrawString(s, mfntPrint, _
Brushes.Black, recCurrent, sfCurrent)
mintCurrentYear += 1
Call DrawStringInBox(ev, cintCol1Start, msngYPos, _
cintColWidth, msngYPos + msngFontHeight, _
"Year")
Call DrawStringInBox(ev, cintCol2Start, msngYPos, _
cintColWidth, msngYPos + msngFontHeight, "Start Value")
Call DrawStringInBox(ev, cintCol3Start, msngYPos, _
cintColWidth, msngYPos + msngFontHeight, "Depreciation")
Call DrawStringInBox(ev, cintCol4Start, msngYPos, _
cintColWidth, msngYPos + msngFontHeight, "End Value")
msngInitialValue = ToSingle(txtInitialValue.Text)
msngSalvageValue = ToSingle(txtSalvageValue.Text)
mintAssetLife = ToInt32(txtAssetLife.Text)
msngTotalDepreciation = msngInitialValue - msngSalvageValue
msngAnnualDepreciation = msngTotalDepreciation / mintAssetLife
msngCurrentValue = msngInitialValue
msngPage = 1
mintCurrentYear = 1
End Sub
End Class