Need help with program containing Financial.DDB method

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

    Need help with program containing Financial.DDB method

    Hello, any help would be greatly appreciated:

    I am trying to code a program that takes 2 testbox and a list box contain 3 to 20 years and use the financial.ddb method to output a string cont of "year depriciation" + the financial.ddb calculation. I debug teh program and I keep getting an Argument 'Factor' is not a valid on the financial.ddb calculation line. Can someone assist me and tell me if I coded the program correctly? Here is my code:

    Code

    Public Class Form1

    Private Sub exitButton2_Cli ck(ByVal sender As Object, ByVal e As System.EventArg s) Handles exitButton2.Cli ck
    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
    End Sub

    Private Sub calculateButton 1_Click(ByVal sender As Object, ByVal e As System.EventArg s) Handles calculateButton 1.Click
    Dim cost As Double
    Dim life As Boolean
    Dim salvage As Double
    Dim period As Double
    Dim number As Integer = 1
    Dim startNdx As Integer
    Dim highNdx As Integer
    Dim fddb As Integer

    Double.TryParse (costTextBox1.T ext, cost)
    Double.TryParse (lifeListBox.Te xt, life)
    Double.TryParse (salvagTextBox. Text, salvage)
    period = 2
    If cost AndAlso life AndAlso salvage Then
    equateTextBox1. Text = " Year Depriciation"
    For curNdx = startNdx To highNdx
    fddb = Financial.DDB(c ost, salvage, life, period)

    equateTextBox1. Text = lifeListBox.Tex t + fddb

    Next



    Else
    MessageBox.Show ("ERROR")

    End If



    End Sub
    End Class

    /code

    I have attached a screen shot of the input gui...

    Thanks guys, you are a life saver!
    Attached Files
Working...