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_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton2.Click
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim code As Integer = 3
Do While code <= 20
lifeListBox.Items.Add(code.ToString)
code = code + 1
Loop
End Sub
Private Sub calculateButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calculateButton1.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.Text, cost)
Double.TryParse(lifeListBox.Text, 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(cost, salvage, life, period)
equateTextBox1.Text = lifeListBox.Text + 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!