开发者

A drop-down with a list of week beginnings dates in VB6

I have a drop-down box in my VB6 form, I was wondering if there was an easy way to have it displaying the dates for the week beginning for the next 4 weeks. E.g. if it was running now it would have,

19/4/2009

26/4/2009

3/5/200开发者_开发技巧9

10/5/2009


Here is a simple method that will do what you want.

   Dim i As Integer
   Dim myDate As Date

   myDate = DateAdd("d", -Weekday(Now), Now)

   For i = 1 To 4
      Combo1.AddItem FormatDateTime(DateAdd("d", i * 7, myDate), vbShortDate)
   Next i


Simply calculate the first day of the week, and then add 7 days.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜