A drop-down list with a list of the beginnings of the week vb6

advertisements

I have a drop down box in my vb6 form, I was wondering if there was an easy way to have it display 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/2009
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