How To Get first day in a week?

Hello,

Using VB.net how would I get the first day of a week when I click any date in that week in the Calendar control in asp.net?

Convert this to VB:

[size=2]public DateTime GetStartOfWeek(DateTime date)
{
	switch(date.DayOfWeek)
	{
		case DayOfWeek.Monday:
			return date.AddDays(0);
		case DayOfWeek.Tuesday:
			return date.AddDays(-1);
		case DayOfWeek.Wednesday:
			return date.AddDays(-2);
		// etc ....
	}
}

[/size]

thank you

Or, conversely, you could do this:


Public Function GetStartOfWeek(ByRef XDate As DateTime) As DateTime

    Return XDate.AddDays(-XDate.DayOfWeek)

End Function

This works because the DayOfWeek.Sunday = 0, DayOfWeek.Monday = 1, etc.