/ Forums / Advansys Formativ / Creating Solutions with Formativ / DateTimePicker / Reply To: DateTimePicker
Hey guys,
now i have two problems… in my code now it works fine when i put a start and end date in the DateTimePicker calender to get only workdays of a week in my field workdays..I put these routine in the Sub PickerEndeChange(Sender) Event Handler…
So my two problems now are, that if the user put the start and end date manually in the fields nothing happens… i think i have to put the routine from the event handler in the main function, but how? and the other thing is, that i want to check if the date was putting correct, because start date can not be bigger then the end date ( if startDate > endDate ?? )
here is my code:
Sub Main(Client, GWEvent)
.
.
.
End Sub
‘ Datefunction Start
Sub PickerStartChange(Sender)
TasoUrlaub.feldStart.Text = DateToStr(TasoUrlaub.PickerStart.Date)
End Sub
‘ Datefunction End
Sub PickerEndChange(Sender)
TasoUrlaub.feldEnd.Text = DateToStr(TasoUrlaub.PickerEnd.Date)
Dim fromDate
Dim toDate
fromDate = TasoUrlaub.PickerStart.Date
toDate = TasoUrlaub.PickerEnd.Date
Dim n
Dim i
Dim d
Dim s
Dim w
n = DateDiff(“d”, fromDate, toDate)
For i = 0 To n
d = DateAdd(“d”,i, fromDate)
w = WeekDay(d)
If w <> 7 AND w <> 1 Then s = s + 1
Next
TasoUrlaub.feldWorkDays.text = s & ” without holidays”
End Sub
thanks for your help…