【问题标题】:inventory multiple forms (shipping)库存多种形式(运费)
【发布时间】:2026-01-01 18:30:01
【问题描述】:

我正在制定库存计划。我在设置替代表单来运送库存时遇到问题。

我认为我下面的代码会采用用户输入的数字,从存储在数组中的数字中减去它,然后将新数字保存到数组中。

任何你知道的在线资源都会很棒。

Public Class Ship

  Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

    If VBProj2.cbInventory.SelectedIndex <> -1 Then
      'VBProj2.cbInventory.Items.RemoveAt(VBProj2.cbInventory.SelectedIndex)
      VBProj2.txtQuantity.Clear()

      Dim intX As Integer = VBProj2.cbInventory.Items.Count
      If txtQuantityNew.Text <= 200 Then
        VBProj2.iquantity(intX) = txtQuantityNew.Text - VBProj2.iquantity(intX)

        MessageBox.Show(VBProj2.iquantity(intX))
        VBProj2.cbInventory.SelectedIndex = VBProj2.cbInventory.Items.Count - 1
      Else
        MessageBox.Show("Please only ship 200 or less")
      End If
      Me.Close()
    Else
      MessageBox.Show("Something fed up")
    End If

  End Sub

End Class

【问题讨论】:

    标签: vb.net visual-studio-2012 inventory multiple-forms


    【解决方案1】:

    在你的代码中

    VBProj2.iquantity(intX) = txtQuantityNew.Text - VBProj2.iquantity(intX)
    

    您实际上从新数量中减去了初始数量,这与您所说的相反,这将是

    VBProj2.iquantity(intX) = VBProj2.iquantity(intX) - val(txtQuantityNew.Text)
    

    【讨论】: