rkann
Apr 11th, 2011, 05:48 PM
This is for Visual Basic 2010 - Depreciation to a Salvage Value of 0.
Below is my code:
Public Class Form1
Dim dblCost, dblLife, dblYear, DblDepreciation, dblBegValue, dblEndValue, dblTotal, Counter
Private Sub lstOutput_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
Private Sub btnStraight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStraight.Click
' Setting Columns, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"
'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)
'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Straight Line")
'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))
'Declare Loop Counters
Dim intA As Integer
'For Figuring Depreciation
DblDepreciation = dblCost / dblLife
'For Figuring Begining Value
dblBegValue = dblCost
Counter = dblCost - DblDepreciation
'Loop for Straight Life Depreciation
For intA = 1 To dblLife
lstOutput.Items.Add(dblYear)
dblBegValue = dblCost - DblDepreciation
lstOutput.Items.Add(" ")
dblTotal = dblCost - dblEndValue
dblEndValue = dblBegValue - DblDepreciation
Next
End Sub
Private Sub btnDouble_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDouble.Click
' Setting Columbs, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"
'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)
'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Double Declining")
'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))
DblDepreciation = dblCost / dblLife
dblBegValue = dblCost - DblDepreciation
dblEndValue = dblBegValue - DblDepreciation
dblTotal = dblCost - dblEndValue
End Sub
Private Function lstOutput() As Object
Throw New NotImplementedException
End Function
Private Function txtCost() As Object
Throw New NotImplementedException
End Function
Private Function txtDescription() As Object
Throw New NotImplementedException
End Function
Private Function txtLife() As Object
Throw New NotImplementedException
End Function
Private Function txtYear() As Object
Throw New NotImplementedException
End Function
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ListBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
End Class
I keep getting the error at
Private Function txtCost() As Object
Throw New NotImplementedException
End Function
that NonImplementedException Unhandled. How can I fix this? I have to turn it in at 11pm tonight and I can't for the life of me figure it out. Please help. Thanks :)
Below is my code:
Public Class Form1
Dim dblCost, dblLife, dblYear, DblDepreciation, dblBegValue, dblEndValue, dblTotal, Counter
Private Sub lstOutput_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
Private Sub btnStraight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStraight.Click
' Setting Columns, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"
'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)
'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Straight Line")
'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))
'Declare Loop Counters
Dim intA As Integer
'For Figuring Depreciation
DblDepreciation = dblCost / dblLife
'For Figuring Begining Value
dblBegValue = dblCost
Counter = dblCost - DblDepreciation
'Loop for Straight Life Depreciation
For intA = 1 To dblLife
lstOutput.Items.Add(dblYear)
dblBegValue = dblCost - DblDepreciation
lstOutput.Items.Add(" ")
dblTotal = dblCost - dblEndValue
dblEndValue = dblBegValue - DblDepreciation
Next
End Sub
Private Sub btnDouble_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDouble.Click
' Setting Columbs, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"
'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)
'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Double Declining")
'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))
DblDepreciation = dblCost / dblLife
dblBegValue = dblCost - DblDepreciation
dblEndValue = dblBegValue - DblDepreciation
dblTotal = dblCost - dblEndValue
End Sub
Private Function lstOutput() As Object
Throw New NotImplementedException
End Function
Private Function txtCost() As Object
Throw New NotImplementedException
End Function
Private Function txtDescription() As Object
Throw New NotImplementedException
End Function
Private Function txtLife() As Object
Throw New NotImplementedException
End Function
Private Function txtYear() As Object
Throw New NotImplementedException
End Function
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ListBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
End Sub
End Class
I keep getting the error at
Private Function txtCost() As Object
Throw New NotImplementedException
End Function
that NonImplementedException Unhandled. How can I fix this? I have to turn it in at 11pm tonight and I can't for the life of me figure it out. Please help. Thanks :)