正如标题所示,我需要帮助改变旧项目的代码,我正在计划为即将到来的项目进行改造。我需要将Financial.DDB更改为Financial.SLN,而不会因为参数太多而发生错误。另外我认为Main_Form_Load内容应该用lstUsefulLife.Items.Add(“2”)替换为(“20”)。有人可以帮忙吗?这是代码。
Public Class Main_Form
Private Sub Main_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
i = 3
Do
lstUsefulLife.Items.Add(i.ToString())
i = i + 1
Loop While i <= 20
End Sub
Private Sub btnSchedule_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSchedule.Click
Dim i As Integer
Dim amount As Double
txtSchedule.Text = ""
txtSchedule.Text = "Year" & vbTab & "Depreciation" & vbNewLine
Dim years As Integer
years = Convert.ToDouble(lstUsefulLife.SelectedItem)
i = 1
Do
amount = Financial.DDB(Convert.ToDouble(txtAsset.Text), Convert.ToDouble(txtSalvage.Text), years, i)
txtSchedule.Text = txtSchedule.Text & i & vbTab & amount.ToString("N2") & vbNewLine
i = i + 1
Loop While i <= years
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
结束班