Syntax of DayofWeek, FirstDayofWeek ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • What-a-Tool

    Syntax of DayofWeek, FirstDayofWeek ?

    Have a group of dynamically created text boxes in a calendar like grid. At
    the head of each column, the textbox is to contain the day of the week.
    Now I am using a Select Case statement to determine the day.
    (Yes, this is a homework assignment-it will do fine using the Select Case
    statement, but it seems that it would contain less code this alternative
    way)

    Col & Row are integers.

    If Row = 0
    Select Case Col
    Case 1 = "Monday"
    and so on...

    What would the syntax of the statements be to set the first day of the week
    to Monday using the FirstDayofWeek statement, and then getting a return of
    the string day value from the Col number using the DayofWeek statement.
    Nothing I've tried seems to work, and I haven't been able to find any code
    samples anywhere to help me.
    Thanks in advance - Sean


  • Armin Zingler

    #2
    Re: Syntax of DayofWeek, FirstDayofWeek ?

    "What-a-Tool" <FrigginSpammer sDieDieDie!@cox .net> schrieb[color=blue]
    > Have a group of dynamically created text boxes in a calendar like
    > grid. At the head of each column, the textbox is to contain the day
    > of the week. Now I am using a Select Case statement to determine the
    > day. (Yes, this is a homework assignment-it will do fine using the
    > Select Case statement, but it seems that it would contain less code
    > this alternative way)
    >
    > Col & Row are integers.
    >
    > If Row = 0
    > Select Case Col
    > Case 1 = "Monday"
    > and so on...
    >
    > What would the syntax of the statements be to set the first day of
    > the week to Monday using the FirstDayofWeek statement, and then
    > getting a return of the string day value from the Col number using
    > the DayofWeek statement. Nothing I've tried seems to work, and I
    > haven't been able to find any code samples anywhere to help me.
    > Thanks in advance - Sean[/color]

    I'm not sure if this is what you are looking for:

    Microsoft.Visua lBasic.DateAndT ime.WeekdayName

    Call: WeekdayName(1) ... WeekdayName(7) (see docs)
    Or: WeekdayName(1, False, FirstDayOfWeek. Monday)
    The last parameter is FirstDayOfWeek. System by default. This should work.
    Nevertheless, if it doesn't (whyever) explicitly pass the
    first-day-of-the-week as the 3rd parameter.

    Note: You must _not_ use members of the Enum System.DayOfWee k as the _first_
    parameter for WeekdayName.


    Concerning DateTime.DayOfW eek: Example: Date.Now.DayOfW eek.ToString =>
    "Sunday". Right, today is Sunday. ;-)

    --
    Armin

    Comment

    • What-a-Tool

      #3
      Re: Syntax of DayofWeek, FirstDayofWeek ?

      That was exactly what I wanted - Thank you, thank you, thank you!
      This is what I used (to late for my homework, but I still wanted to know!)

      'Set Text into column headers(Columns and Rows start with zero)

      If Row = 0 Then

      txtNew.Text = WeekdayName(Col + 1, False, FirstDayOfWeek. Monday)

      End If

      Thanks - Sean



      "Armin Zingler" <az.nospam@free net.de> wrote in message
      news:%23oMTQICg DHA.3248@tk2msf tngp13.phx.gbl. ..[color=blue]
      > "What-a-Tool" <FrigginSpammer sDieDieDie!@cox .net> schrieb[color=green]
      > > Have a group of dynamically created text boxes in a calendar like
      > > grid. At the head of each column, the textbox is to contain the day
      > > of the week. Now I am using a Select Case statement to determine the
      > > day. (Yes, this is a homework assignment-it will do fine using the
      > > Select Case statement, but it seems that it would contain less code
      > > this alternative way)
      > >
      > > Col & Row are integers.
      > >
      > > If Row = 0
      > > Select Case Col
      > > Case 1 = "Monday"
      > > and so on...
      > >
      > > What would the syntax of the statements be to set the first day of
      > > the week to Monday using the FirstDayofWeek statement, and then
      > > getting a return of the string day value from the Col number using
      > > the DayofWeek statement. Nothing I've tried seems to work, and I
      > > haven't been able to find any code samples anywhere to help me.
      > > Thanks in advance - Sean[/color]
      >
      > I'm not sure if this is what you are looking for:
      >
      > Microsoft.Visua lBasic.DateAndT ime.WeekdayName
      >
      > Call: WeekdayName(1) ... WeekdayName(7) (see docs)
      > Or: WeekdayName(1, False, FirstDayOfWeek. Monday)
      > The last parameter is FirstDayOfWeek. System by default. This should work.
      > Nevertheless, if it doesn't (whyever) explicitly pass the
      > first-day-of-the-week as the 3rd parameter.
      >
      > Note: You must _not_ use members of the Enum System.DayOfWee k as the[/color]
      _first_[color=blue]
      > parameter for WeekdayName.
      >
      >
      > Concerning DateTime.DayOfW eek: Example: Date.Now.DayOfW eek.ToString =>
      > "Sunday". Right, today is Sunday. ;-)
      >
      > --
      > Armin
      >[/color]


      Comment

      • What-a-Tool

        #4
        Re: Syntax of DayofWeek, FirstDayofWeek ?

        WeekdayName(1, False, FirstDayOfWeek. Monday)

        What's the "false" property set?
        Tells it that the default first day of week is not Sunday?

        "Armin Zingler" <az.nospam@free net.de> wrote in message
        news:%23oMTQICg DHA.3248@tk2msf tngp13.phx.gbl. ..[color=blue]
        > "What-a-Tool" <FrigginSpammer sDieDieDie!@cox .net> schrieb[color=green]
        > > Have a group of dynamically created text boxes in a calendar like
        > > grid. At the head of each column, the textbox is to contain the day
        > > of the week. Now I am using a Select Case statement to determine the
        > > day. (Yes, this is a homework assignment-it will do fine using the
        > > Select Case statement, but it seems that it would contain less code
        > > this alternative way)
        > >
        > > Col & Row are integers.
        > >
        > > If Row = 0
        > > Select Case Col
        > > Case 1 = "Monday"
        > > and so on...
        > >
        > > What would the syntax of the statements be to set the first day of
        > > the week to Monday using the FirstDayofWeek statement, and then
        > > getting a return of the string day value from the Col number using
        > > the DayofWeek statement. Nothing I've tried seems to work, and I
        > > haven't been able to find any code samples anywhere to help me.
        > > Thanks in advance - Sean[/color]
        >
        > I'm not sure if this is what you are looking for:
        >
        > Microsoft.Visua lBasic.DateAndT ime.WeekdayName
        >
        > Call: WeekdayName(1) ... WeekdayName(7) (see docs)
        > Or: WeekdayName(1, False, FirstDayOfWeek. Monday)
        > The last parameter is FirstDayOfWeek. System by default. This should work.
        > Nevertheless, if it doesn't (whyever) explicitly pass the
        > first-day-of-the-week as the 3rd parameter.
        >
        > Note: You must _not_ use members of the Enum System.DayOfWee k as the[/color]
        _first_[color=blue]
        > parameter for WeekdayName.
        >
        >
        > Concerning DateTime.DayOfW eek: Example: Date.Now.DayOfW eek.ToString =>
        > "Sunday". Right, today is Sunday. ;-)
        >
        > --
        > Armin
        >[/color]


        Comment

        • Armin Zingler

          #5
          Re: Syntax of DayofWeek, FirstDayofWeek ?

          "What-a-Tool" <FrigginSpammer sDieDieDie!@cox .net> schrieb[color=blue]
          > WeekdayName(1, False, FirstDayOfWeek. Monday)
          >
          > What's the "false" property set?
          > Tells it that the default first day of week is not Sunday?[/color]

          Do you use Notepad for programming?


          --
          Armin

          Comment

          • What-a-Tool

            #6
            Re: Syntax of DayofWeek, FirstDayofWeek ?

            No - sorry - stupid of me. Forgot about the "intellisen se" feature before I
            asked the question. Just copied and pasted your "WeekdayNam e(1, False,
            FirstDayOfWeek. Monday)" into my program, so it didn't come up till I went
            back and typed it in manually.
            Thanks again

            "Armin Zingler" <az.nospam@free net.de> wrote in message
            news:uBgA27NgDH A.2408@TK2MSFTN GP09.phx.gbl...[color=blue]
            > "What-a-Tool" <FrigginSpammer sDieDieDie!@cox .net> schrieb[color=green]
            > > WeekdayName(1, False, FirstDayOfWeek. Monday)
            > >
            > > What's the "false" property set?
            > > Tells it that the default first day of week is not Sunday?[/color]
            >
            > Do you use Notepad for programming?
            >
            >
            > --
            > Armin
            >[/color]


            Comment

            Working...