Format text in labels...

skipsy

Member
Licensed User
Longtime User
Hello all,

Do you have any idea why this :
Lbl_B_Chaude2.Text = 1
displays the "1" in a label

and then :
Lbl_B_Chaude2.Text = Lbl_B_Chaude2.Text + NumberFormat( 1, 2, 0 )
displays "2.0" as I expect to get "2"

???

Thks,
William.
 

skipsy

Member
Licensed User
Longtime User
Works fine.

I don't understand why the addition did not returned an integer... But
it works this way.

Thank you.
WW
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
By default Basic4Android transforms text to double variables and in this case the display is 2.0, or you display it with a given NumberFormat.
The best way to make calculations is to use the right variable type Int Float or Double and then show it in a Label.
If you add two Integer variables and show the result in a label it would display in your case 2.

Best regards.
 
Upvote 0
Top