Simple VB question

Soldato
Joined
4 Sep 2005
Posts
12,830
Location
London
Hey all.

I've got a line of code that is basically multiplication and division. Is there any way to make it do certain bits first? Like when you put brackets around certain things in multiplication?

Code:
lblInGBP.Caption = ExchangeRate(17) * txtAmount - txtAmount / 100 * txtCommision.Text

Not sure if that would make much sense to anyone? :confused:

Thanks anyway
 
Your best bet is to break it down pretty much in reverse order, from the innermost brackets first.

lblInGBP.Caption = ExchangeRate(17) * (txtAmount - ((txtAmount / 100) * txtCommision.Text))
 
Last edited:
Thanks. Got a bit closer now :)

It's subtracting the commision rate properly now. I just dont get an accurate result.

edit: Fixed it. Fault on my behalf

Cheers m8 :)
 
Back
Top Bottom