I have 2 edittext views that hold each a certain date. I can change either dates using the below function, which is OK. But, if I click on either text box and decide to change my mind by clicking the 'Cancel' button, the dates do not revert back to what were in the boxes. They both display blank dates. Can someone please see where I falter. Thanks
B4X:
Dim strDate as string
dim ViewStartD, ViewEndD as edittext
Sub InputBoxDD(Prompt As String, Title As String) As String
Dim Dd As DateDialog
Dim ret As Int
Dd.Year = DateTime.GetYear(DateTime.now)
Dd.Month = DateTime.GetMonth(DateTime.now)
Dd.DayOfMonth = DateTime.GetDayOfMonth(DateTime.now)
ret = Dd.Show(Prompt, Title, "Ok", "Cancel", "", Null)
If ret=-1 Then
strDate= DateTime.Date(Dd.DateTicks)
End If
End Sub
Sub ViewStartD_Click
InputBoxDD("Accept or change START Date","DATE SELECTION SCREEN")
ViewStartD.text=strDate
End Sub
Sub ViewEndD_Click
InputBoxDD("Accept or change END Date","DATE SELECTION SCREEN")
ViewEndD.text=strDate
End Sub
Last edited: