[RESOLVED] Can someone help me plese
I am trying to write a program that for an RPG. the program works like a shop where the user selects the item froma combo box and it is added to a list box, this part works but the function to total the price doesnt work. when i try it overwrites the data already in the box.
Here is the code that i am using
Code:
Private Sub Command1_Click()
List1.AddItem Combo1.Text
Label1.Caption = Combo1.ItemData(Combo1.ListIndex)
End Sub
Private Sub Form_Load()
Combo1.AddItem "Laser pistol"
Combo1.ItemData(Combo1.NewIndex) = 1000
Combo1.AddItem "Laser SMG"
Combo1.ItemData(Combo1.NewIndex) = 1500
End Sub
can anyone help?
thanks in advance
Re: Can someone help me plese
try this:
Code:
Dim a As Double
Private Sub Command1_Click()
List1.AddItem Combo1.Text
a = a + Val(Combo1.ItemData(Combo1.ListIndex))
Label1.Caption = a
End Sub
Private Sub Form_Load()
Combo1.AddItem "Laser pistol"
Combo1.ItemData(Combo1.NewIndex) = 1000
Combo1.AddItem "Laser SMG"
Combo1.ItemData(Combo1.NewIndex) = 1500
End Sub
Re: Can someone help me plese
Re: Can someone help me plese
Quote:
Originally Posted by Stormcrow
thanks, that worked
Welcome to the forums. :wave:
As a newer member I ask that if you consider your question to be resolved please help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you. :)