我陷入了视觉基本编码,

时间:2016-09-14 10:00:00

标签: vb.net

我想通过输入框编辑列表框中的数据,列表框填充为零。每当我尝试编辑数据时,我会双击列表框输入框弹出,我也会输入值,然后我点击确定我遇到了一个值为' 0&#39的错误;不适用于' index'。

 Private Sub I1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles I1.MouseDoubleClick
        Dim objInputBox As Object = InputBox("current1 :", "Edit", I1.SelectedItem)
        If Not objInputBox = Nothing Then
            I1.Items(I1.SelectedIndex) = objInputBox
        End If

        Dim eff As Double
        eff = Convert.ToDouble(Me.eff.Text)
        Dim i As Integer = I1.SelectedIndex
        Power.Items(i) = I1.Items(i) * Qty_list.Items(i) * Label27.Text + I2.Items(i) * Qty_list.Items(i) * Label28.Text + I3.Items(i) * Qty_list.Items(i) * Label29.Text + I4.Items(i) * Qty_list.Items(i) * Label30.Text + I5.Items(i) * Qty_list.Items(i) * Label31.Text + I6.Items(i) * Qty_list.Items(i) * Label32.Text + I7.Items(i) * Qty_list.Items(i) * Label33.Text + I8.Items(i) * Qty_list.Items(i) * Label34.Text + I9.Items(i) * Qty_list.Items(i) * Label35.Text + I10.Items(i) * Qty_list.Items(i) * Label36.Text
        Dim sum As Double
        For x As Integer = 0 To Power.Items.Count - 1
            sum += CDbl(Power.Items(x)) * eff
        Next
        totalpower.Text = sum.ToString

        Dim tcc1 As Integer = 0
        ' loops the listbox to all items
        For a As Integer = 0 To Qty_list.Items.Count - 1
            tcc1 = tcc1 + (CInt(Qty_list.Items(a).ToString) * CInt(I1.Items(a).ToString)) * eff
        Next
        Label39.Text = tcc1


        Label50.Text = Label27.Text * Label39.Text * eff
    End Sub

我在所有标签上都面临错误。

0 个答案:

没有答案