|
-
December 2nd, 2015, 12:31 PM
#1
Straight Line Depreciation Table in Visual Basic 2013 Express
In my straight line depreciation program in my depreciation list box results table
1 2015 25000 4000 4000 21000
2 2016 21000 4000 8000 17000
3 2017 17000 4000 12000 13000
4 2018 13000 4000 16000 9000
5 9000 9000 4000 20000 5000
in my Depreciation Table Results
Original Price $25,000.00
Salvage Value $ 5,000.00
Estimated Years 5
Year Purchased 2015
Depreciable Cost $20,000.00
Depreciation Expense $4000.00
Total Years 5
Total Years Purchased 2020
Accumulated Depreciation 20,000
Book Value $5,000.00
in the Original Price textbox was $5,000.00 but, the correct original price is $25000.00
I have tried to talk to people how this program but, I had no success. I also did some moving the figures around but, no success. Where place the depreciable cost, depreciation expense, total years, total years purchased, accumulated depreciation and book value. I also had trouble doing that on a rich texbox doing do while statements do I use these figures?
Code:
Public Class Form1
Private Sub BtnExitDepreciationResults495_Click(sender As Object, e As EventArgs) Handles BtnExitDepreciationResults495.Click
Me.Close()
End Sub
Private Sub BtnClearDepreciationResults495_Click(sender As Object, e As EventArgs) Handles BtnClearDepreciationResults495.Click
Me.Price495.Text = " "
Me.SalvageValue495.Text = " "
Me.Years495.Text = " "
Me.YearPurchased495.Text = " "
Me.DepCost495.Text = " "
Me.DeprecExpense495.Text = " "
Me.TotalYears495.Text = " "
Me.TotalYearsPurchased495.Text = " "
Me.Accum495.Text = " "
Me.BookValue495.Text = " "
Me.ListBoxDepreciationResults495.Items.Clear()
Me.ListBoxDepreciationResultsTable495.Items.Clear()
End Sub
Dim i As Integer
Private Sub BtnDisplayDepreciationResults495_Click(sender As Object, e As EventArgs) Handles BtnDisplayDepreciationResults495.Click
Dim Price495A As Double
Dim SalvageValue495A As Double
Dim Years495A As Integer
Dim YearPurchased495A As Integer
Dim DepCost495A As Double
Dim DeprecExpense495A As Double
Dim TotalYears495A As Integer
Dim TotalYearsPurchased495A As Integer
Dim Accum495A As Double
Dim BookValue495A As Double
If IsNumeric(Me.Price495.Text) Then
Price495A = CDbl(Me.Price495.Text)
If Price495A > 0 Then
MessageBox.Show("You entered your Original Price has been Accepted " & Price495A.ToString("c2") & " Have a Good God Blessed Day ")
Else
MessageBox.Show("I am sorry to tell you that you entered a negative Original Price " & Price495A.ToString("c2") & " " & " Have a Good God Blessed Day " & " " & " Input Error ")
Price495.Text = " "
Price495.Focus()
End If
Else
MessageBox.Show("I am sorry to tell you that you entered an alpabetical or entered an alphanumeric and/or your left your Original Price blank " & Price495A.ToString("c2") & " Please Enter Original Price " & " " & " Input Error ")
Price495.Text = " "
Price495.Focus()
End If
If IsNumeric(Me.SalvageValue495.Text) Then
SalvageValue495A = CDbl(Me.SalvageValue495.Text)
If SalvageValue495A > 0 Then
MessageBox.Show("Your Salvage Value you entered is accepted " & SalvageValue495A.ToString("c2") & " " & " Have a God Blessed Day ")
Else
MessageBox.Show("Your Salvage Value you entered is a negative number " & SalvageValue495A.ToString("c2") & " " & " Please enter Your Salvage Value Greater than zero Have a God Bless Day " & " " & " Input Error ")
SalvageValue495.Text = " "
SalvageValue495.Focus()
End If
Else
MessageBox.Show("I am sorry to tell you that you entered an alpabetical or entered an alphanumeric and/or you left your Salvage Value Blank " & SalvageValue495A.ToString("C2") & " " & " Please Enter Salvage Value Amount Value " & " " & " Input Error ")
SalvageValue495.Text = " "
SalvageValue495.Focus()
End If
If IsNumeric(Me.Years495.Text) Then
Years495A = CInt(Me.Years495.Text)
If Years495A > 0 Then
MessageBox.Show("The Estimated Years you entered is a numeric is Accepted " & Years495A & " " & " Have a God Blessed Day ")
Else
MessageBox.Show("The Estimated Years you entered is a negative number " & Years495A & " " & " Please Enter Estimated Years is greater than Zero Have a God Blessed Day " & " " & " Input Error ")
Years495.Text = " "
Years495.Focus()
End If
Else
MessageBox.Show("I am sorry to tell you that you entered an alpabetical or entered an alphanumeric and/or you left your Estimated Years Blank " & Years495A & " " & " Please Enter Estimated Years " & " " & " Input Error ")
Years495.Text = " "
Years495.Focus()
End If
If IsNumeric(Me.YearPurchased495.Text) Then
YearPurchased495A = CInt(Me.YearPurchased495.Text)
If YearPurchased495A > 0 Then
MessageBox.Show("Your Year Purchased Amount you entered is Accepted " & YearPurchased495A & " " & "Have a God Blessed Day ")
Else
MessageBox.Show("Your Year Purchased Amount you entered is a negative Number " & YearPurchased495A & " " & " Please Enter Your Year Purchased Amount Greater than zero " & " Input Error ")
YearPurchased495.Text = " "
YearPurchased495.Focus()
End If
Else
MessageBox.Show("I am sorry to tell you that you entered an alpabetical or entered an alphanumeric and/or you left your Years Purchased Amount " & " " & YearPurchased495A & " " & " Please Enter Year Purchased Amount " & " " & " Input Error ")
YearPurchased495.Text = " "
YearPurchased495.Focus()
End If
TotalYearsPurchased495A = YearPurchased495A
DepCost495A = Price495A - SalvageValue495A
DeprecExpense495A = DepCost495A / Years495A
ListBoxDepreciationResults495.Items.Add("Original Price " & Price495A.ToString("c2"))
ListBoxDepreciationResults495.Items.Add("Salvage Value " & SalvageValue495A.ToString("c2"))
ListBoxDepreciationResults495.Items.Add("Estimated Years " & Years495A)
ListBoxDepreciationResults495.Items.Add("Year Purchased " & YearPurchased495A)
ListBoxDepreciationResults495.Items.Add("Depreciable Cost " & DepCost495A.ToString("C2"))
ListBoxDepreciationResults495.Items.Add("Depreciation Expenes " & DeprecExpense495A.ToString("c2"))
For i As Integer = 1 To Years495A
BookValue495A = Price495A - DeprecExpense495A
TotalYears495A += 1
TotalYearsPurchased495A += 1
Accum495A += DeprecExpense495A
ListBoxDepreciationResultsTable495.Items.Add(TotalYears495A & " " & TotalYearsPurchased495A & " " & Price495A.ToString("c2") & " " & DeprecExpense495A.ToString("c2") & " " & Accum495A.ToString("C2") & " " & BookValue495A.ToString("C2"))
Price495A = BookValue495A
Next
ListBoxDepreciationResults495.Items.Add("Total Years " & TotalYears495A)
ListBoxDepreciationResults495.Items.Add("Total Year Purchased " & TotalYearsPurchased495A)
ListBoxDepreciationResults495.Items.Add("Accumulated Depreciation " & Accum495A.ToString("c2"))
ListBoxDepreciationResults495.Items.Add("Book Value " & BookValue495A.ToString("c2"))
Me.Price495.Text = Price495A.ToString("c2")
Me.SalvageValue495.Text = SalvageValue495A.ToString("c2")
Me.Years495.Text = CInt(Years495A)
Me.YearPurchased495.Text = CInt(YearPurchased495A)
Me.DepCost495.Text = CDbl(DepCost495A.ToString("c2"))
Me.DeprecExpense495.Text = CDbl(DeprecExpense495A.ToString("c2"))
Me.TotalYears495.Text = CInt(TotalYears495A)
Me.TotalYearsPurchased495.Text = CInt(TotalYearsPurchased495A)
Me.Accum495.Text = CDbl(Accum495A.ToString("C2"))
Me.BookValue495.Text = CDbl(BookValue495A.ToString("C2"))
BookValue495A = Price495A - Accum495A
End Sub
End Class
-
December 2nd, 2015, 12:34 PM
#2
Re: Straight Line Depreciation Table in Visual Basic 2013 Express
can I ask in the future if I could ask about my straight line depreciation in a rich textbox every time also I make run time error it takes too much time to reveal it. What can I do about it?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|