Hi all,
I'm a beginner to VB6. Right now I'm doing a project to calculate an asset depreciation using Straight-Line and Double Declining method. I managed to get my coding and result right but the problem is with the output. My questions are..
a. How to show the figure in currency with only two decimal points?
b. How to fix the output arrangement in the listbox?
Attachment 96633
Here are the codes for the Straight Line Method button.
I'm a beginner to VB6. Right now I'm doing a project to calculate an asset depreciation using Straight-Line and Double Declining method. I managed to get my coding and result right but the problem is with the output. My questions are..
a. How to show the figure in currency with only two decimal points?
b. How to fix the output arrangement in the listbox?
Attachment 96633
Here are the codes for the Straight Line Method button.
Code:
Private Sub btnStraight_Click()
Dim description As String
Dim yearPurchased As Integer
Dim cost As Double
Dim estimatedLife As Integer
Dim amountDepr As Double
Dim totalDepr As Double
Dim i As Integer
totalDepr = 0
description = txtDesc.Text
yearPurchased = txtYrPurchased.Text
cost = txtCost.Text
estimatedLife = txtLife.Text
lstResult.AddItem (" Description: " & description)
lstResult.AddItem (" Year of Purchase: " & yearPurchased)
lstResult.AddItem (" Cost: " & cost)
lstResult.AddItem (" Estimated Life: " & estimatedLife)
lstResult.AddItem (" Method of Depreciation: straight-line method")
lstResult.AddItem ("")
lstResult.AddItem (" " & "Value at " & " Amount Deprec " & " Total Depreciation")
lstResult.AddItem (" Year" & " Beg of Yr" & " During Year" & " to End of Year")
For i = 1 To estimatedLife
amountDepr = cost / estimatedLife
If i = estimatedLife Then
amountDepr = cost
End If
totalDepr = totalDepr + amountDepr
lstResult.AddItem (" " & yearPurchased & " " & cost & " " & amountDepr & " " & totalDepr)
cost = cost - amountDepr
yearPurchased = yearPurchased + 1
Next
End Sub