So here is where I am at. I can’t get anything to display on the list box that I created named “depreciationListBox” I have been working on this project for a while and I am quite stumped. Any pointers or solutions that anyone could help me would be much appreciated.
Private Sub displayButton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles displayButton.Click
Dim cost As Double
Dim life As Double = CDbl(lifeListBox.SelectedItem)
Dim period As Double
Dim nextPeriod As Double
Dim salvage As Double
Dim depreciation As Double
Dim isConvertedCost As Boolean
Dim isConvertedLife As Boolean
Dim isConvertedSalvage As Boolean
isConvertedCost = Double.TryParse(AssetTextBox.Text, cost)
isConvertedLife = Double.TryParse(lifeListBox.Text, life)
isConvertedSalvage = Double.TryParse(salvageTextBox.Text, salvage)
For nextPeriod = 1 To period Step 1
depreciation = Financial.DDB(cost, salvage, life, nextPeriod)
depreciationListBox.Text += nextPeriod.ToString & " " & _
Convert.ToString(depreciation) _
& ControlChars.NewLine
Next nextPeriod
If isConvertedCost AndAlso isConvertedLife _
AndAlso isConvertedSalvage Then
depreciationListBox.Text = " Year Depreciation "
End If
End Sub
Where did I go wrong? Here is a link to what the assignment is and an image of how it is supposed to look: http://books.google.com/books?id=UAo8tAQRvGUC&pg=PT415&lpg=PT415&dq=sonheim+manufacturing&source=bl&ots=G74EzxAphD&sig=tS7s6EUUmgWrq6ZXphhDhDaBpsw&hl=en&sa=X&ei=KM8pT7mPA6qq2QWtq_ncAg&ved=0CEgQ6AEwBA#v=onepage&q=sonheim%20manufacturing&f=false
In your loop, you loop from 1 to period, but you never initialize period. The default value for period would be 0, which means the loop will never run.