MonthName Help Example Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    MonthName Help Example Problem

    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(MyMon th, True) ' "True" returns an abbreviated name.
    MsgBox(Name) ' Name contains "Apr".

  • Herfried K. Wagner [MVP]

    #2
    Re: MonthName Help Example Problem

    "Bob" <Bob@discussion s.microsoft.com > schrieb:[color=blue]
    >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(MyMon th, True) ' "True" returns an abbreviated
    > name.
    > MsgBox(Name) ' Name contains "Apr".[/color]

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

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

    Comment

    • Rothariger

      #3
      RE: MonthName Help Example Problem

      i think you have the problem in another place... i try the code and works
      just fine!

      "Bob" wrote:
      [color=blue]
      > 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(MyMon th, True) ' "True" returns an abbreviated name.
      > MsgBox(Name) ' Name contains "Apr".
      >[/color]

      Comment

      • Bob

        #4
        Re: MonthName Help Example Problem

        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:
        [color=blue]
        > "Bob" <Bob@discussion s.microsoft.com > schrieb:[color=green]
        > >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(MyMon th, True) ' "True" returns an abbreviated
        > > name.
        > > MsgBox(Name) ' Name contains "Apr".[/color]
        >
        > Qualify the function's name with the module containing it
        > ('DateAndTime.M onthName').
        >
        > --
        > M S Herfried K. Wagner
        > M V P <URL:http://dotnet.mvps.org/>
        > V B <URL:http://classicvb.org/petition/>
        >
        >[/color]

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: MonthName Help Example Problem

          "Bob" <Bob@discussion s.microsoft.com > schrieb:[color=blue]
          >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.[/color]

          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/>

          Comment

          Working...