DateTimePicker
-
I have a dateTimePicker control on my form and I am working on a payroll entry form. I want the datetimepicker to default to the following sunday for the period ending date, if the user selects a day during the week. does anyone have any suggestions on how i could do this using the ValueChanged event? Thanks
-
I have a dateTimePicker control on my form and I am working on a payroll entry form. I want the datetimepicker to default to the following sunday for the period ending date, if the user selects a day during the week. does anyone have any suggestions on how i could do this using the ValueChanged event? Thanks
DateTime dt=DateTimePicker.Value;
dt=dt.AddDays((7-dt.DayOfWeek)%7);:)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
DateTime dt=DateTimePicker.Value;
dt=dt.AddDays((7-dt.DayOfWeek)%7);:)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
That worked wonders, I can even use the same logic to grab the beginning of the week. Thanks