JonnyCav
Member
I'm trying to enable a user to simply press a plus or minus button to move the date up or down. I do not want a DatePicker becuase it will only be for a couple of days either way.
The 'Log' results are perfect but the txtDate (perfect on entry) becomes ticks when the button is clicked
I'd like to allow multiple clicks (i.e. -1, -2, -3 )
Here's my code
Any ideas where I'm fouling up?
The 'Log' results are perfect but the txtDate (perfect on entry) becomes ticks when the button is clicked
I'd like to allow multiple clicks (i.e. -1, -2, -3 )
Here's my code
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
DateTime.DateFormat="dd-MMM-yyyy"
Dim cdate As String
cdate=DateTime.Date(DateTime.Now)
txtDate.Text=cdate
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub btnPlus_Click
Dim plusDay As Long
DateTime.DateFormat="dd-MMM-yyyy"
plusDay = DateTime.Add(DateTime.Now, 0, 0, 1)
Log("Tomorrow's date is: " & DateTime.Date(plusDay))
txtDate.Text=plusDay
End Sub
Private Sub btnMinus_Click
Dim minusDay As Long
minusDay = DateTime.Add(DateTime.Now, 0, 0, -1)
DateTime.DateFormat="dd-MMM-yyyy"
Log("Yesterday's date was: " & DateTime.Date(minusDay))
txtDate.Text=minusDay
End Sub
Any ideas where I'm fouling up?