I have a button on one form that is the "buy" button. When someone clicks it it gives them a inputbox asking how many grams of heroin they want to buy
![Evil Grin](images/smilies/evilgrinblack.gif)
, When they click this it finds out if they have enough money at first. Then if they do it subtracts how much it cost from there money and adds however many they wanted to the heroin variable (showing how many they have in there inventory) but when i go to the inventory it wont show up. But when you buy some buds it shows up. here it the buy button code:
Private Sub Command15_Click()
' buying heroin
buy = InputBox("How many do you want to buy", "How many?")
If buy * dheroin < cash Then
MsgBox ("You just bought " & buy & " grams of heroin")
final = buy * dheroin
cash = cash - final
heroin = heroin + buy
Else
MsgBox ("You dont have enough money")
End If
End Sub
Dheroin is how much the heroin costs. buy is the number the user wants to buy. final is how many they want to buy times how much it costs. cash is there current money, and heroin is the variable that stores how much heroin the user has.
On another form, the inventory page, it shows how much of each drug the user has and I have it set up so it will update the label that shows how much for heroin you have by setting the interaval on timer to 5. and when the 5 is up it just sets itself back to 5.
here is the timer script:
heroin1.Caption = heroin
heroin1 is the label.