dateutils problem

dgoss

Member
Licensed User
Longtime User
Lbl9hr = Label
chkb1 = checkbox
the checkbox is on a seperate panel to the Label

B4X:
Sub Chkb1_CheckedChange(Checked As Boolean)
   If Chkb1.Checked = True Then
DoRestTimes
   End If
End Sub


' This sub don't work. Gives date in Ticks but gives the right time
Sub DoRestTimes
   p.Hours =11
   Lbl9Hr.Visible = True
   dim newDate6 as long = DateUtils.AddPeriod(DateTime.now,p)
Lbl9Hr.Text = DateUtils.TicksToString(newDate6)
End Sub

' this sub works. Give date and time
Sub Lbl9Hr_Click
   P.Hours = 9
Dim newDate As Long = DateUtils.AddPeriod(DateTime.Now, P)
   Lbl9Hr.Text =  DateUtils.TicksToString(newDate)
End Sub

If i click the label first it works fine. But if i click chbk1 first neither of then
work as should. ie: date in Ticks But Correct time
:sign0085:what am i doing wrong
Thx in advance
 
Last edited:
Top