Get first day of the month using MonthCalendar control

  • Thread starter Thread starter gv
  • Start date Start date
G

gv

Hi all,

Using VB Express 2005

How do I get the day of the first day of the month using the
MonthCalendar control. so if the MonthCalendar control is
set to the systems date.


thanks
gv
 
This is what I came up with? any thing wrong with it?

Dim SystemDatefirstofmonth As Date
Dim FirstDayofMonthName As String
SystemDatefirstofmonth =
DateTime.Now.AddDays(-MonthCalendar1.TodayDate.Day)
FirstDayofMonthName = WeekdayName(Weekday(SystemDatefirstofmonth))

thanks
gv
 
ok

I think the previous was wrong how about this?

Dim firstday As Date = MonthCalendar1.TodayDate
Dim Hdays As Day = MonthCalendar1.TodayDate.Day
firstday = firstday.AddDays(-Hdays).AddDays(1)

thanks
gv
 
Here's how I would do it

DateTime d = new DateTime(monthCalendar1.TodayDate.Year,
monthCalendar1.TodayDate.Month, 1);
string day = d.DayOfWeek.ToString();

I know it is in C# but it is the same.
Tim
 
Back
Top