|
-
Nov 26th, 2008, 09:23 AM
#1
Thread Starter
New Member
[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
-
Nov 26th, 2008, 09:45 AM
#2
Hyperactive Member
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
"More Heads are Better than One"
-
Nov 26th, 2008, 09:48 AM
#3
Thread Starter
New Member
Re: Can someone help me plese
-
Nov 26th, 2008, 09:57 AM
#4
Re: Can someone help me plese
 Originally Posted by Stormcrow
thanks, that worked
Welcome to the forums. 
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.
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
|