2013-04-17 44 views
0

我正在清點程序。我在設置替代表單以運送廣告資源時遇到問題。庫存多種形式(運費)

我認爲我下面的代碼將需要輸入的號碼由用戶從存儲陣列中的數減去它,然後保存新號碼到陣列中。

,你知道網上的任何資源將是巨大的。

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 

回答

0

在你的代碼在這裏

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

你居然減去新數量的初始量,你怎麼說你想這樣做,相反這將是

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