![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
"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] |
#4
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |