HELP with Financial.DDB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CJ Densmore
    New Member
    • Dec 2010
    • 4

    HELP with Financial.DDB

    Really need some help with the code below. How to I convert the financial.ddb method to give me an outoput calculation equal to the method... when I run the code, my label only shows 0 when I should be getting some kind of calculation. Financial.ddb is basically Depreciation / Period = ((Cost – Salvage) * Factor) / Life

    My code uses a list box for life and I have a feeling that this is the culprit... can someone PLEASE help!

    code

    Public Class Form1

    Private Sub exitButton_Clic k(ByVal sender As Object, ByVal e As System.EventArg s) Handles exitButton.Clic k
    Me.Close()

    End Sub

    Private Sub Form1_Load(ByVa l sender As Object, ByVal e As System.EventArg s) Handles Me.Load
    Dim code As Integer = 3
    Do While code <= 20
    lifeListBox.Ite ms.Add(code.ToS tring)
    code = code + 1
    Loop
    lifeListBox.Ite ms(0) = 3
    lifeListBox.Ite ms(1) = 4
    lifeListBox.Ite ms(2) = 5
    lifeListBox.Ite ms(3) = 6
    lifeListBox.Ite ms(4) = 7
    lifeListBox.Ite ms(5) = 8
    lifeListBox.Ite ms(6) = 9
    lifeListBox.Ite ms(7) = 10
    lifeListBox.Ite ms(8) = 11
    lifeListBox.Ite ms(9) = 12
    lifeListBox.Ite ms(10) = 13
    lifeListBox.Ite ms(11) = 14
    lifeListBox.Ite ms(12) = 15
    lifeListBox.Ite ms(13) = 16
    lifeListBox.Ite ms(14) = 17
    lifeListBox.Ite ms(15) = 18
    lifeListBox.Ite ms(16) = 19
    lifeListBox.Ite ms(17) = 20

    End Sub


    Private Sub DDSButton1_Clic k(ByVal sender As Object, ByVal e As System.EventArg s) Handles DDSButton1.Clic k

    Dim cost As Double
    Dim life As Double
    Dim period As Double
    Dim salvage As Double
    Dim depreciation As Double
    Dim isConvertedCost As Boolean
    Dim isConvertedLife As Boolean
    Dim isConvertedSalv age As Boolean
    Dim depriciation As Double
    isConvertedCost = Double.TryParse (assetcostTextB ox.Text, cost)
    isConvertedLife = Double.TryParse (lifeListBox.Te xt, life)
    isConvertedSalv age = Double.TryParse (salvagevalueTe xtBox.Text, salvage)

    If isConvertedCost AndAlso isConvertedLife AndAlso isConvertedSalv age Then
    dsoutTextBox.Te xt = " Year Depreciation"

    For Year As Double = 0.01 To 0.05 Step 0.01
    depriciation = Financial.DDB(c ost, salvage, life, 1, 2.0)
    dsoutTextBox.Te xt = dsoutTextBox.Te xt & ControlChars.Ne wLine & Year.ToString(" P0") & depreciation.To String("C2")

    Next Year

    dsoutTextBox.Fo cus()

    /code

    Thank you!
Working...