Quote:
|
Originally Posted by dddriveman
I am just trying to click on commmand buttons that say Robot COntroller or Battery and they list the price in a picture box. I have all of that done but i cannot get the program to total all of the parts that i have selected becasue my variables will not carry over from the sub command for the command buttons when i press my total button. I am using vb6.0
|
PICTURE BOX?!?!?!?!? 
Use a text box, first of all. The Text property is the equivelent of Value.
Are you using Quanity textboxes, too?
say:
- cbRC_Add as CommandButton
- cbBat_Add as CommandButton
- tbRC_Quanity as Textbox
- lblRC_Total as Label
- lblRC_Price as Label
- tbBat_Quanity as Textbox
- lblBat_Total as Label
- lblBat_Price as Label
- tbTotal as Label
These are the controls on your form.
So:
Code:
const RC_Price as currency = 500 'Sub type of variant
const Bat_Price as currency = 100
dim RC_Quanity as long, RC_Total as Currency
dim Bat_Quanity as long, Bat_Total as currency
dim Total as currency
private sub Form_Load ()
RC_Quanity = 0
Bat_Quanity = 0
Update
end sub
Public sub Update()
RC_Total = RC_Price * RC_Quanity
Bat_Total = Bat_Price * Bat_Quanity
Total = RC_Total + Bat_Total
tbRC_Quanity = RC_Quanity
tbRC_Total = RC_Total
lblRC_Price = RC_Price
tbBat_Quanity = Bat_Quanity
tbBat_Total = Bat_Total
lblBat_Price = Bat_Price
tbTotal = Total
end sub
Be sure to insert Event hadlers for the command buttons and text boxes (Check for correct type).