Android Question Change Decimal number to whole number

Good Day Everyone! i have little problem about my timer, when I subtract the lblTime itself by 1 the result is decimal numbers.
how do i change it to whole numbers?

Here is my Code:

B4X:
Sub Timer1_Tick
    CountDown = CountDown -1
    lblSeconds.Text = CountDown
    If CountDown = 0 Then
        CountDown = 5
    End If
  
    If lblSeconds.Text = 0 Then
       lblTime.Text = lblTime.Text - 1
    End If
  
    If lblTime.Text = 0 Then
        'ToastMessageShow ("Time's Up!!","")
        Timer1.Enabled = False
    End If
End Sub
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Try this:

B4X:
Sub Timer1_Tick
    CountDown = CountDown -1
    lblSeconds.Text = CountDown
    If CountDown = 0 Then
        CountDown = 5
    End If
  
    If lblSeconds.Text = 0 Then
       lblTime.Text = cInt(lblTime.Text) - 1
    End If
  
    If lblTime.Text = 0 Then
        'ToastMessageShow ("Time's Up!!","")
        Timer1.Enabled = False
    End If
End Sub

Private Sub cInt(o as Object) as Int
    Return Floor(o)
End Sub

- Colin.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…