所以这就是我所处的位置。我无法在我创建的名为“depreciationListBox”的列表框中显示任何内容我已经在这个项目上工作了一段时间而且我很难过。任何人都可以帮助我的任何指针或解决方案将不胜感激。
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
我哪里出错了?以下是分配内容的链接以及它应如何显示的图像: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
答案 0 :(得分:2)
使用depreciationListBox.Items.Add(nextPeriod.ToString & " " & Convert.ToString(depreciation))
对于VB6,您应该使用.AddItem。
答案 1 :(得分:1)
在你的循环中,你从1循环到句点,但你永远不会初始化句号。句点的默认值为0,表示循环永远不会运行。