Help filling comboBox with Week End Dates
From: Jake (Jake_at_discussions.microsoft.com)
Date: 07/19/04
- Next message: DJ van Vliet: "Re: C#, ADO.NET and MS-SQL"
- Previous message: lurker_at_night.com: "Re: 2 Questions - one about memory usuage and the other about files"
- Next in thread: Sky Sigal: "Re: Help filling comboBox with Week End Dates"
- Reply: Sky Sigal: "Re: Help filling comboBox with Week End Dates"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 19 Jul 2004 12:57:04 -0700
Hello,
I am a long time VB programmer moving to C#. I am trying to fill a comboBox in C# with Week End Dates. The code I would use in VB would be the following.
Dim ThisDay As DateTime = Today
Dim EndOfWeek As DateTime = Today
If Not ThisDay.DayOfWeek = DayOfWeek.Sunday Then
Do Until EndOfWeek.DayOfWeek = DayOfWeek.Sunday
EndOfWeek = EndOfWeek.Add(TimeSpan.FromDays(1))
Loop
Else
EndOfWeek = ThisDay
End If
Dim WeekCount As Integer
For WeekCount = -5 To 5
Me.ComboBox1.Items.Add(DateAdd(DateInterval.WeekOfYear, WeekCount, EndOfWeek).ToShortDateString)
Next
unable to use DateAdd and DateInterval in C# I have been stuck on this solution for some time. Any help from a long time C# guru would be great.
Thanks in advance.
Jake
- Next message: DJ van Vliet: "Re: C#, ADO.NET and MS-SQL"
- Previous message: lurker_at_night.com: "Re: 2 Questions - one about memory usuage and the other about files"
- Next in thread: Sky Sigal: "Re: Help filling comboBox with Week End Dates"
- Reply: Sky Sigal: "Re: Help filling comboBox with Week End Dates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|