无法显示列表框

时间:2014-10-15 19:05:33

标签: listbox

我被困在这里。我无法将解决方案打印到列表框中。我无法找到我所缺少的东西。我需要帮助。你看到的任何东西都会有很大的帮助。这是我程序中的所有代码:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    For years As Integer = 3 To 20
        Lifebox.Items.Add(years.ToString)
    Next years
    Lifebox.SelectedIndex = 0
End Sub

Private Sub CloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseButton.Click
    Me.Close()
End Sub

Private Sub DisplayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayButton.Click
    Dim cost As Double
    Dim life As Double
    Dim period As Double
    Dim numberperiod 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(Assetbox.Text, cost)
    isConvertedLife = Double.TryParse(Lifebox.Text, life)
    isConvertedSalvage = Double.TryParse(SalavageBox.Text, salvage)

    For numberperiod = 1 To period Step 1
        depreciation = Financial.DDB(cost, salvage, life, numberperiod)
        DepBox.Text += numberperiod.ToString & " -> " & Convert.ToString(depreciation) _
        & ControlChars.NewLine
    Next numberperiod


    If isConvertedCost AndAlso isConvertedLife AndAlso isConvertedSalvage Then
        DepBox.Text = "    Year    Depreciation   "






    Else
        MessageBox.Show("The cost, life, and salvage values must be numeric.",
                        "Sonheim Manufacturing Company", MessageBoxButtons.OK,
                        MessageBoxIcon.Information)

        Assetbox.Focus()
    End If
End Sub
End Class

0 个答案:

没有答案