Visual Basic 2008

Remove this Banner Ad

carltonfc4eva

Senior List
Suspended
Oct 16, 2008
243
0
western suburbs
AFL Club
Carlton
Does anyone know how to add labels?
I have 5 labels or so which display the cost of a certain food. eg lblBurger will display the cost for how ever many burgers you order. I need a label to display the total cost, but when I added the lalels up they just did it like this : lblburger would be $3 lblChips $2 so i would do lbltotal = lblchips +lblburger
but it would come out as 32
Anyone know the correct way to add these?
 
Does anyone know how to add labels?
I have 5 labels or so which display the cost of a certain food. eg lblBurger will display the cost for how ever many burgers you order. I need a label to display the total cost, but when I added the lalels up they just did it like this : lblburger would be $3 lblChips $2 so i would do lbltotal = lblchips +lblburger
but it would come out as 32
Anyone know the correct way to add these?

I haven't used vb for a while, but i believe you need to do this:

( lbltotal.text = lblchips.tetx + lblburger.text )

try it out
 
Does anyone know how to add labels?
I have 5 labels or so which display the cost of a certain food. eg lblBurger will display the cost for how ever many burgers you order. I need a label to display the total cost, but when I added the lalels up they just did it like this : lblburger would be $3 lblChips $2 so i would do lbltotal = lblchips +lblburger
but it would come out as 32
Anyone know the correct way to add these?


actually sorry, im not sure if the above will do anything different

you might have to convert the lblchips and lblburger to an int or double, then do the addition

so something like this:

dim chips as Integer
dim burger as Integer
dim total as Integer

chips = CInt(lblchips.text)
burger = CInt(lblburger.text)
total = burger + chips
lbltotal.text = total
 

Log in to remove this ad.

Remove this Banner Ad

Visual Basic 2008

Remove this Banner Ad

Back
Top