S skipsy Member Licensed User Longtime User Jul 14, 2012 #1 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.
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.
klaus Expert Licensed User Longtime User Jul 14, 2012 #2 Try this: Lbl_B_Chaude2.Text = NumberFormat((Lbl_B_Chaude2.Text) + 1, 1, 0 ) Best regards Upvote 0
S skipsy Member Licensed User Longtime User Jul 14, 2012 #3 Works fine. I don't understand why the addition did not returned an integer... But it works this way. Thank you. WW Upvote 0
Works fine. I don't understand why the addition did not returned an integer... But it works this way. Thank you. WW
klaus Expert Licensed User Longtime User Jul 14, 2012 #4 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
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.