By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,184 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,184 IT Pros & Developers. It's quick & easy.

Get first day of the month using MonthCalendar control

P: n/a
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
Dec 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
"gv" <vi*****@musc.edu> wrote in message
news:ur*************@TK2MSFTNGP15.phx.gbl...
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

Dec 21 '05 #2

P: n/a
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

"gv" <vi*****@musc.edu> wrote in message
news:ur*************@TK2MSFTNGP15.phx.gbl...
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

Dec 21 '05 #3

P: n/a
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
"gv" wrote:
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

"gv" <vi*****@musc.edu> wrote in message
news:ur*************@TK2MSFTNGP15.phx.gbl...
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


Dec 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.