开发者

Setting a date/time to a date time picker in .net 1.1

开发者 https://www.devze.com 2022-12-14 15:29 出处:网络
I have a datetime picker in one of our apps. When loading up the win f开发者_StackOverflow社区orm I need the date time picker to default to the Wednesday following todays date. Any idea how to do this

I have a datetime picker in one of our apps. When loading up the win f开发者_StackOverflow社区orm 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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消