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

MonthName Help Example Problem

P: n/a
Bob
I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated name.
MsgBox(Name) ' Name contains "Apr".

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies

P: n/a
"Bob" <Bo*@discussions.microsoft.com> schrieb:
I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can
not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated
name.
MsgBox(Name) ' Name contains "Apr".


Qualify the function's name with the module containing it
('DateAndTime.MonthName').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
i think you have the problem in another place... i try the code and works
just fine!

"Bob" wrote:
I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated name.
MsgBox(Name) ' Name contains "Apr".

Nov 21 '05 #3

P: n/a
Bob
I found out what the probelm was. When I created the project I named it
MonthName instead of MonthNameDemo. SO the project name and the function were
named the same.

"Herfried K. Wagner [MVP]" wrote:
"Bob" <Bo*@discussions.microsoft.com> schrieb:
I cut and pasted the following from the HELP into the form load event of a
new form and I get an error stating that MonthName is a namespace and can
not
be used as shown. What's wrong?

Dim MyMonth As Integer
Dim Name As String
MyMonth = 4
Name = MonthName(MyMonth, True) ' "True" returns an abbreviated
name.
MsgBox(Name) ' Name contains "Apr".


Qualify the function's name with the module containing it
('DateAndTime.MonthName').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
"Bob" <Bo*@discussions.microsoft.com> schrieb:
I found out what the probelm was. When I created the project I named it
MonthName instead of MonthNameDemo. SO the project name and the function
were
named the same.


ACK. By default the project's root namespace has the name of the project.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.