|
-
Dec 2nd, 2002, 10:47 AM
#1
Thread Starter
Junior Member
Totals go up by one!!
i've got the code below... my prob. is when i remove a quanitity or cost from their lstBoxs, the totals should be subtracted from that quantity or cost. but instead both totals go up by one???
no idea why
Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
If lstProduct.SelectedIndex <> -1 Then
quantity = CDbl(lstQuantity.SelectedIndex)
totalQuantity = Val(lblTotalQuantity.Text) - quantity
lblTotalQuantity.Text = CStr(totalQuantity)
totalQuantity = 0 ' Intialising totalQuantity
totalCost = CDec(Val(lblTotalCost.Text) - lstCost.SelectedIndex)
lblTotalCost.Text = CStr(totalCost)
totalCost = 0 ' initialising totalcost
lstQuantity.Items.RemoveAt(lstProduct.SelectedIndex)
lstCost.Items.RemoveAt(lstProduct.SelectedIndex)
lstProduct.Items.RemoveAt(lstProduct.SelectedIndex)
Else
MsgBox("PLease select an item to be removed")
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|