Question

I have a datetime picker in one of our apps. When loading up the win form I need the date time picker to default to the Wednesday following todays date. Any idea how to do this? We are using .Net 1.1 for this app.

Thanks, Mike

Was it helpful?

Solution

this should do it...just add days until you hit the next wednesday

Public Function GetNextDayOfWeek(ByVal dow As DayOfWeek) As DateTime
       Dim d = DateTime.Now.AddDays(1)
       While d.DayOfWeek <> dow
           d = d.AddDays(1)
       End While

       Return d
   End Function
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top