I am using DateDialog of Dialogs library . I want to set the title , content date of dialog and should change when user edits the date value of date dialog . How to code this ?:BangHead:
Dim Dd As DateDialog
Dim ret As Int
Dd.Year = DateTime.GetYear(DateTime.now) 'set the display year
Dd.Month = DateTime.GetMonth(DateTime.now) 'set the display month
Dd.DayOfMonth = DateTime.GetDayOfMonth(DateTime.now) 'set the display day
ret = Dd.Show("Set the required date", "Block Off Date", "Ok", "Cancel", "", Null)
When you define the DateDialog (DD in the above example) when you 'dot' it the IDE displays the options it has (see attached image). This makes it easy to use the librarys.
Just to add to Iagore: If you want to return the final date selected as a string here is the code:
B4X:
Dim Dd As DateDialog
Dim ret As Int
Dim strDate As String
Dd.Year = DateTime.GetYear(DateTime.now) 'set the display year
Dd.Month = DateTime.GetMonth(DateTime.now) 'set the display month
Dd.DayOfMonth = DateTime.GetDayOfMonth(DateTime.now) 'set the display day
ret = Dd.Show("Set the required date", "Date Selection".ToUpperCase, "Ok", "Cancel", "", Null)
If ret=-1 Then
strDate= DateTime.Date(Dd.DateTicks)
Msgbox(strDate,"")
End If
Actually this was not my problem . I am using the dialog without problems . My intention is to set the title as date content of dialog . Initially I can add it . But it should change as the user edits the date . I want to know this particular thing only .
This is my code
B4X:
Sub btnDate_Click
Dim ret As Int
Dim datitle as String
Dim dadi As DateDialog
dadi.Year=txtyyyy.Text:dadi.Month=txtmm.Text:dadi.DayOfMonth=txtdd.Text
datitle = dadi.DayOfMonth & "/" & dadi.Month & "/" & dadi.Year
ret=dadi.show("Set Date ",datitle,"O K","Cancel","",Null)
End Sub
Hi Gjoisa, I know this was about 2 years ago but did you ever get a reply to your question. I am trying to show the Day as it is changed by to user . Not after they click OK but as the date is changed on the fly.
Regards Peter.