HighTechTalks DotNet Forums  

DayofWeek, FirstDayofWeek syntax?

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss DayofWeek, FirstDayofWeek syntax? in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
What-a-Tool
 
Posts: n/a

Default DayofWeek, FirstDayofWeek syntax? - 09-20-2003 , 06:46 PM






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





Reply With Quote
  #2  
Old   
Peter van der Goes
 
Posts: n/a

Default Re: DayofWeek, FirstDayofWeek syntax? - 09-21-2003 , 09:37 AM







"What-a-Tool" <FrigginSpammersDieDieDie!@cox.net> wrote

Quote:
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

FirstDayOfWeek is a property of the MonthCalendar control, not something you
can use with your grid of textboxes. There is also the FirstDayOfWeek
enumeration that specifies the valid values for the DayOfWeek arguments, as
well as the possible return values from VB intrinsic date functions. This
enum (per the help) is designed to be used with the calendar controls to
declare the first day of the week for display purposes.
Unless you write a class definition to define your "custom calendar" and
include a property for the first day of the week and set/get methods to deal
with it, FirstDayOfWeek won't be available unless you use an instance of the
MonthCalendar in your project. Then, it is available only to be used with
the MonthCalendar control.
To make it available in your project outside an existing class, you'd have
to define it.
--
Peter - [MVP - Academic]





Reply With Quote
  #3  
Old   
What-a-Tool
 
Posts: n/a

Default Re: DayofWeek, FirstDayofWeek syntax? - 09-21-2003 , 06:35 PM



Thanks for the reply, but I did find how to do what I needed (or was told
how to, anyway!)

If Row = 0 Then
txtNew.Text = WeekdayName(Col + 1, False, FirstDayOfWeek.Monday)
End If

This method was suggested by a very helpful person on
Microsoft.public.dotnet.languages.vb and is the method that I ended up
using - Worked like a charm!

Thanks - Sean


"Peter van der Goes" <p_vandergoes (AT) mars (DOT) cox.net> wrote

Quote:
"What-a-Tool" <FrigginSpammersDieDieDie!@cox.net> wrote in message
news:rN4bb.341$0Z5.68 (AT) lakeread03 (DOT) ..
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

FirstDayOfWeek is a property of the MonthCalendar control, not something
you
can use with your grid of textboxes. There is also the FirstDayOfWeek
enumeration that specifies the valid values for the DayOfWeek arguments,
as
well as the possible return values from VB intrinsic date functions. This
enum (per the help) is designed to be used with the calendar controls to
declare the first day of the week for display purposes.
Unless you write a class definition to define your "custom calendar" and
include a property for the first day of the week and set/get methods to
deal
with it, FirstDayOfWeek won't be available unless you use an instance of
the
MonthCalendar in your project. Then, it is available only to be used with
the MonthCalendar control.
To make it available in your project outside an existing class, you'd have
to define it.
--
Peter - [MVP - Academic]






Reply With Quote
  #4  
Old   
Peter van der Goes
 
Posts: n/a

Default Re: DayofWeek, FirstDayofWeek syntax? - 09-21-2003 , 08:30 PM




"What-a-Tool" <FrigginSpammersDieDieDie!@cox.net> wrote

Quote:
Thanks for the reply, but I did find how to do what I needed (or was told
how to, anyway!)

If Row = 0 Then
txtNew.Text = WeekdayName(Col + 1, False, FirstDayOfWeek.Monday)
End If

This method was suggested by a very helpful person on
Microsoft.public.dotnet.languages.vb and is the method that I ended up
using - Worked like a charm!

Thanks - Sean

Thanks for showing us that technique, Sean! I never would have thought of
that.




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.