J
JAMES VISUAL BASIC LOVER 495
Guest
My program in Visual Basic 2019 Detail Line Calculations are fine for my Straight Line Depreciation using a Listbox but, no error checking this time. On the other hand, my column line results On my Depreciable cost is $0.00 that is a wrong answer the correct answer is $60,000. The Depreciation Expense result is $0.00 that is the wrong answer the correct answer is $5,000.00. The Total Years answer is 0 but, the correct answer is 12. The Total Years Purchased answer is 0 but, the correct answer is 2031. The Accumulated Depreciation Result is $0.00 but, the correct answer is $60,000.00. The Book Value result is $0.00 but, the correct answer is $5,000.00. Can someone help me with this program that is easy for me to debug. Thank You
Sincerely Yours,
James Delorn Howland Jr.
[Public Class Form1
Private Sub BtnStrLineDeprec495f_Click(sender As Object, e As EventArgs) Handles BtnStrLineDeprec495f.Click
Dim TxtAccountNo495A As Integer = 0
Dim MaskedSocSecNo495A As String = "000-00-0000"
Dim TxtCustName495A As String = " "
Dim TxtItemNumber495A As Integer = 0
Dim TxtColorComboBox495A As String = " "
Dim TxtDescriptionName495A As String = " "
Dim TxtOrigPrice495A As Double = 0
Dim TxtSalvageValue495A As Double = 0
Dim TxtYears495A As Integer = 0
Dim TxtYearPurchased495A As Integer = 0
Dim TxtDepreciableCost495A As Double = 0
Dim TxtDeprecExpense495A As Double = 0
Dim TxtTotalYears495A As Integer = 0
Dim TxtTotalYearsPurchased495A As Integer = 0
Dim TxtAccumDeprec495A As Double = 0
Dim TxtBookValue495A As Double = 0
Dim TORIG As Double = 0
'Dim DepCost495A As Double = 0
TxtAccountNo495A = CInt(TxtAccountNo495.Text)
MaskedSocSecNo495A = CStr(MaskedSocSecNo495.Text)
TxtCustName495A = CStr(TxtCustName495.Text)
TxtItemNumber495A = CInt(TxtItemNumber495.Text)
TxtColorComboBox495A = CStr(TxtColorComboBox495.Text)
TxtDescriptionName495A = CStr(TxtDescriptionName495.Text)
TxtOrigPrice495A = CDbl(TxtOrigPrice495.Text)
TxtSalvageValue495A = CDbl(TxtSalvageValue495.Text)
TxtYears495A = CInt(TxtYears495.Text)
TxtYearPurchased495A = CInt(TxtYearPurchased495.Text)
TxtTotalYearsPurchased495A = TxtYearPurchased495A
ListOutput495.Items.Add("Account Number " & vbTab & TxtAccountNo495A & vbNewLine)
ListOutput495.Items.Add("Social Security Number " & vbTab & MaskedSocSecNo495A & vbNewLine)
ListOutput495.Items.Add("Customer Name " & vbTab & TxtCustName495A & vbNewLine)
ListOutput495.Items.Add("Item Number " & vbTab & TxtItemNumber495A & vbNewLine)
ListOutput495.Items.Add("Item Color " & vbTab & TxtColorComboBox495A & vbNewLine)
ListOutput495.Items.Add("Item Name " & vbTab & TxtDescriptionName495A & vbNewLine)
ListOutput495.Items.Add("Original Price " & vbTab & TxtOrigPrice495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Salvage Value " & vbTab & TxtSalvageValue495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Estimated Years " & vbTab & TxtYears495A & vbNewLine)
ListOutput495.Items.Add("Year Purchased " & vbTab & TxtYearPurchased495A & vbNewLine)
ListOutput495.Items.Add("Depreciable Cost " & vbTab & TxtDepreciableCost495A.ToString("c2"))
ListOutput495.Items.Add("Depreciation Expense " & vbTab & TxtDeprecExpense495A.ToString("c2"))
ListOutput495.Items.Add("Total Years " & vbTab & TxtTotalYears495A & vbNewLine)
ListOutput495.Items.Add("Total Years Purchased " & vbTab & TxtTotalYearsPurchased495A & vbNewLine)
ListOutput495.Items.Add("Accumulated Depreciation " & vbTab & TxtAccumDeprec495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Book Value " & vbTab & TxtBookValue495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Total Total Years Original Depreciation Accumulated Book " & vbNewLine)
ListOutput495.Items.Add("Years Purchased Price Expense Depreciation Value " & vbNewLine)
ListOutput495.Items.Add(" ")
TORIG = TxtOrigPrice495A
For yr = 1 To TxtYears495A
TxtDepreciableCost495A = TxtOrigPrice495A - TxtSalvageValue495A
TxtDeprecExpense495A = TxtDepreciableCost495A / TxtYears495A
TxtTotalYears495A += 1
TxtTotalYearsPurchased495A += 1
TxtAccumDeprec495A = TxtAccumDeprec495A + (TxtDepreciableCost495A / TxtYears495A)
TxtBookValue495A = TxtOrigPrice495A - TxtAccumDeprec495A
TxtBookValue495A = TORIG - TxtDeprecExpense495A
ListOutput495.Items.Add(vbTab & TxtTotalYears495A & " " & TxtTotalYearsPurchased495A & TORIG.ToString("C2") & " " & TxtDeprecExpense495A.ToString("C2") & " " & TxtAccumDeprec495A.ToString("c2") & " " & TxtBookValue495A.ToString("c2") & vbNewLine)
TORIG = TxtBookValue495A
Next
TxtAccountNo495.Text = CInt(TxtAccountNo495A)
MaskedSocSecNo495.Text = CStr(MaskedSocSecNo495A)
TxtCustName495.Text = CStr(TxtCustName495A)
TxtItemNumber495.Text = CInt(TxtItemNumber495A)
TxtColorComboBox495.Text = CStr(TxtColorComboBox495A)
TxtDescriptionName495.Text = CStr(TxtDescriptionName495A)
TxtOrigPrice495.Text = CDbl(TxtOrigPrice495A.ToString("c2"))
TxtSalvageValue495.Text = CDbl(TxtSalvageValue495A.ToString("c2"))
TxtYears495.Text = CInt(TxtYears495A)
TxtYearPurchased495.Text = CInt(TxtYearPurchased495A)
TxtDepreciableCost495.Text = CDbl(TxtDepreciableCost495A.ToString("c2"))
TxtDeprecExpense495.Text = CDbl(TxtDeprecExpense495A.ToString("c2"))
TxtTotalYears495.Text = CInt(TxtTotalYears495A)
TxtTotalYearsPurchased495.Text = CInt(TxtTotalYearsPurchased495A)
TxtAccumDeprec495.Text = CDbl(TxtAccumDeprec495A.ToString("c2"))
TxtBookValue495.Text = CDbl(TxtBookValue495A.ToString("c2"))
End Sub
Private Sub BtnClear495_Click(sender As Object, e As EventArgs) Handles BtnClear495.Click
TxtAccountNo495.Text = " "
MaskedSocSecNo495.Text = " "
TxtCustName495.Text = " "
TxtItemNumber495.Text = " "
TxtColorComboBox495.Text = " "
TxtDescriptionName495.Text = " "
TxtOrigPrice495.Text = " "
TxtSalvageValue495.Text = " "
TxtYears495.Text = " "
TxtYearPurchased495.Text = " "
TxtDepreciableCost495.Text = " "
TxtDeprecExpense495.Text = " "
TxtTotalYears495.Text = " "
TxtTotalYearsPurchased495.Text = " "
TxtAccumDeprec495.Text = " "
TxtBookValue495.Text = " "
ListOutput495.Items.Clear()
End Sub
Private Sub BtnExit495_Click(sender As Object, e As EventArgs) Handles BtnExit495.Click
Me.Close()
End Sub
End Class]
JAMES DELORN HOWLAND JR.
Continue reading...
Sincerely Yours,
James Delorn Howland Jr.
[Public Class Form1
Private Sub BtnStrLineDeprec495f_Click(sender As Object, e As EventArgs) Handles BtnStrLineDeprec495f.Click
Dim TxtAccountNo495A As Integer = 0
Dim MaskedSocSecNo495A As String = "000-00-0000"
Dim TxtCustName495A As String = " "
Dim TxtItemNumber495A As Integer = 0
Dim TxtColorComboBox495A As String = " "
Dim TxtDescriptionName495A As String = " "
Dim TxtOrigPrice495A As Double = 0
Dim TxtSalvageValue495A As Double = 0
Dim TxtYears495A As Integer = 0
Dim TxtYearPurchased495A As Integer = 0
Dim TxtDepreciableCost495A As Double = 0
Dim TxtDeprecExpense495A As Double = 0
Dim TxtTotalYears495A As Integer = 0
Dim TxtTotalYearsPurchased495A As Integer = 0
Dim TxtAccumDeprec495A As Double = 0
Dim TxtBookValue495A As Double = 0
Dim TORIG As Double = 0
'Dim DepCost495A As Double = 0
TxtAccountNo495A = CInt(TxtAccountNo495.Text)
MaskedSocSecNo495A = CStr(MaskedSocSecNo495.Text)
TxtCustName495A = CStr(TxtCustName495.Text)
TxtItemNumber495A = CInt(TxtItemNumber495.Text)
TxtColorComboBox495A = CStr(TxtColorComboBox495.Text)
TxtDescriptionName495A = CStr(TxtDescriptionName495.Text)
TxtOrigPrice495A = CDbl(TxtOrigPrice495.Text)
TxtSalvageValue495A = CDbl(TxtSalvageValue495.Text)
TxtYears495A = CInt(TxtYears495.Text)
TxtYearPurchased495A = CInt(TxtYearPurchased495.Text)
TxtTotalYearsPurchased495A = TxtYearPurchased495A
ListOutput495.Items.Add("Account Number " & vbTab & TxtAccountNo495A & vbNewLine)
ListOutput495.Items.Add("Social Security Number " & vbTab & MaskedSocSecNo495A & vbNewLine)
ListOutput495.Items.Add("Customer Name " & vbTab & TxtCustName495A & vbNewLine)
ListOutput495.Items.Add("Item Number " & vbTab & TxtItemNumber495A & vbNewLine)
ListOutput495.Items.Add("Item Color " & vbTab & TxtColorComboBox495A & vbNewLine)
ListOutput495.Items.Add("Item Name " & vbTab & TxtDescriptionName495A & vbNewLine)
ListOutput495.Items.Add("Original Price " & vbTab & TxtOrigPrice495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Salvage Value " & vbTab & TxtSalvageValue495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Estimated Years " & vbTab & TxtYears495A & vbNewLine)
ListOutput495.Items.Add("Year Purchased " & vbTab & TxtYearPurchased495A & vbNewLine)
ListOutput495.Items.Add("Depreciable Cost " & vbTab & TxtDepreciableCost495A.ToString("c2"))
ListOutput495.Items.Add("Depreciation Expense " & vbTab & TxtDeprecExpense495A.ToString("c2"))
ListOutput495.Items.Add("Total Years " & vbTab & TxtTotalYears495A & vbNewLine)
ListOutput495.Items.Add("Total Years Purchased " & vbTab & TxtTotalYearsPurchased495A & vbNewLine)
ListOutput495.Items.Add("Accumulated Depreciation " & vbTab & TxtAccumDeprec495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Book Value " & vbTab & TxtBookValue495A.ToString("c2") & vbNewLine)
ListOutput495.Items.Add("Total Total Years Original Depreciation Accumulated Book " & vbNewLine)
ListOutput495.Items.Add("Years Purchased Price Expense Depreciation Value " & vbNewLine)
ListOutput495.Items.Add(" ")
TORIG = TxtOrigPrice495A
For yr = 1 To TxtYears495A
TxtDepreciableCost495A = TxtOrigPrice495A - TxtSalvageValue495A
TxtDeprecExpense495A = TxtDepreciableCost495A / TxtYears495A
TxtTotalYears495A += 1
TxtTotalYearsPurchased495A += 1
TxtAccumDeprec495A = TxtAccumDeprec495A + (TxtDepreciableCost495A / TxtYears495A)
TxtBookValue495A = TxtOrigPrice495A - TxtAccumDeprec495A
TxtBookValue495A = TORIG - TxtDeprecExpense495A
ListOutput495.Items.Add(vbTab & TxtTotalYears495A & " " & TxtTotalYearsPurchased495A & TORIG.ToString("C2") & " " & TxtDeprecExpense495A.ToString("C2") & " " & TxtAccumDeprec495A.ToString("c2") & " " & TxtBookValue495A.ToString("c2") & vbNewLine)
TORIG = TxtBookValue495A
Next
TxtAccountNo495.Text = CInt(TxtAccountNo495A)
MaskedSocSecNo495.Text = CStr(MaskedSocSecNo495A)
TxtCustName495.Text = CStr(TxtCustName495A)
TxtItemNumber495.Text = CInt(TxtItemNumber495A)
TxtColorComboBox495.Text = CStr(TxtColorComboBox495A)
TxtDescriptionName495.Text = CStr(TxtDescriptionName495A)
TxtOrigPrice495.Text = CDbl(TxtOrigPrice495A.ToString("c2"))
TxtSalvageValue495.Text = CDbl(TxtSalvageValue495A.ToString("c2"))
TxtYears495.Text = CInt(TxtYears495A)
TxtYearPurchased495.Text = CInt(TxtYearPurchased495A)
TxtDepreciableCost495.Text = CDbl(TxtDepreciableCost495A.ToString("c2"))
TxtDeprecExpense495.Text = CDbl(TxtDeprecExpense495A.ToString("c2"))
TxtTotalYears495.Text = CInt(TxtTotalYears495A)
TxtTotalYearsPurchased495.Text = CInt(TxtTotalYearsPurchased495A)
TxtAccumDeprec495.Text = CDbl(TxtAccumDeprec495A.ToString("c2"))
TxtBookValue495.Text = CDbl(TxtBookValue495A.ToString("c2"))
End Sub
Private Sub BtnClear495_Click(sender As Object, e As EventArgs) Handles BtnClear495.Click
TxtAccountNo495.Text = " "
MaskedSocSecNo495.Text = " "
TxtCustName495.Text = " "
TxtItemNumber495.Text = " "
TxtColorComboBox495.Text = " "
TxtDescriptionName495.Text = " "
TxtOrigPrice495.Text = " "
TxtSalvageValue495.Text = " "
TxtYears495.Text = " "
TxtYearPurchased495.Text = " "
TxtDepreciableCost495.Text = " "
TxtDeprecExpense495.Text = " "
TxtTotalYears495.Text = " "
TxtTotalYearsPurchased495.Text = " "
TxtAccumDeprec495.Text = " "
TxtBookValue495.Text = " "
ListOutput495.Items.Clear()
End Sub
Private Sub BtnExit495_Click(sender As Object, e As EventArgs) Handles BtnExit495.Click
Me.Close()
End Sub
End Class]
JAMES DELORN HOWLAND JR.
Continue reading...