Hi,
Can someone help me translate this code to b4a .?
i tried but nope it just worked
thanks for advance
Can someone help me translate this code to b4a .?
VB.net:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim numcount As Integer
Dim Starttime As DateTime
Try
numcount = numcount + 1
If RadioButton1.Checked = True Then
Starttime = New DateTime(Now.Year, Now.Month, Now.Day, 0, 0, 0)
Else
Starttime = New DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month, dateTimePicker2.Value.Day, dateTimePicker2.Value.Hour, dateTimePicker2.Value.Minute, dateTimePicker2.Value.Second)
End If
Starttime = Starttime.AddSeconds(NumericUpDown2.Value)
Dim ref As New DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second)
ref = ref.AddSeconds(NumericUpDown3.Value)
Dim final As TimeSpan = ref - Starttime
Dim Resto As Double = final.TotalSeconds Mod numericUpDown1.Value
label1.Text = Resto
Label2.Text = ref.Second
Catch ex As Exception
End Try
End Sub
i tried but nope it just worked
B4X:
Private Sub Timer1_Tick
Try
numcount = numcount + 1
Starttime = DateUtils.SetDateAndTime(DateTime.GetYear(DateTime.Now), DateTime.GetMonth(DateTime.Now), DateTime.GetDayOfMonth(DateTime.Now), 0, 0, 0)
Dim ref As Long =DateUtils.SetDateAndTime(DateTime.GetYear(DateTime.Now), DateTime.GetMonth(DateTime.Now), DateTime.GetDayOfMonth(DateTime.Now), DateTime.GetHour(DateTime.Now), DateTime.GetMinute(DateTime.Now), DateTime.GetSecond(DateTime.Now))
ref = ref + MaskedEditText2.text.Replace("_","")*1000
Dim final As Long = ref - Starttime
Dim Resto As Long = final Mod (MaskedEditText3.text.Replace("_","")*1000)
Label7.Text = Resto
Label2.Text =DateTime.GetSecond(ref)
Catch As Exception
End Try
End Sub
thanks for advance
Last edited: