Home

The Month Calendar Control

 

Introduction to the Month Calendar Control

 

Description

Microsoft Windows provides a control used to select dates on a colorful calendar:

The Month Calendar control

The dates used and the way they display are based on the Regional Settings of the Control Panel. It may also depend on the operating system. This convenient control is called month calendar or simply calendar. The title bar of the control displays two buttons and two labels. The left button allows the user to select the previous month by clicking the button. The left label displays the currently selected month. The right label displays the year of the displayed date. The right button is used to get to the next month.

The calendar can be configured to display more than one month. Here is an example that displays two months:

The Month Calendar control displaying two months

If the control is displaying more than one month, the buttons would increment or decrement by the previous or next month in the list. For example, if the control is displaying April and May and if the user clicks the left button, the control would display March and April. If the control is displaying April and May and the user clicks the right button, the control would display May and June. Also, to select any month of the current year, the user can click the name of the month, which displays the list of months and this allows the user to click the desired month:

The Month Calendar control displaying the list of months

To select a year, the user can click the year number. This changes the year label into a spin button:

The Month Calendar control allowing the user to select a year

To change the year, the user can click the up or down arrows of the spin button. As the spin button is displaying, the user can also use the arrow keys of the keyboard to increase or decrease the value.

Under the title bar, the short names of week days display, using the format set in Control Panel. In US English, the first day is usually Sunday. The first day can be changed by the programmer.

On the control, the currently selected date has a circle around. To select a date on the control, the user clicks the desired date, which changes from the previous selection.

In the main area, the numeric days of the month display on a white background (this color and any color on the control can be changed as we will see in the next section). To select a date, the user clicks it in the list. By default, the calendar opens with today's day circled with a hand-drawn-look-alike ellipse. Using the buttons of the title bar, the month label, and/or the year, the user can change the date. If at one time the calendar is displaying a date other than today, and if the user wants to return to today's date, he or she can click the bottom label that displays Today (you as the programmer can hide the Today label if you want).

Creating a Calendar

To create a calendar control, you can click the MonthCalendar button MonthCalendar in the Toolbox and click the form or the desired container. The MonthCalendar control is based on the MonthCalendar class, which is based on Control. Therefore, to create a calendar control, declare a variable or type MonthCalendar and initialize it appropriately. Here is an example:

Imports System.Drawing
Imports System.Windows.Forms

Module Exercise

    Public Class Starter
        Inherits Form

        Private Calendar As MonthCalendar

        Dim components As System.ComponentModel.Container

        Public Sub New()
            InitializeComponent()
        End Sub

        Public Sub InitializeComponent()
            Calendar = New MonthCalendar

            Controls.Add(Calendar)
        End Sub

    End Class

    Function Main() As Integer

        Dim frmStart As Starter = New Starter

        Application.Run(frmStart)

        Return 0
    End Function

End Module

 

Practical LearningPractical Learning: Introducing the Month Calendar Control

  1. Start a new Windows Application named PayrollProcessing2
  2. In the Solution Explorer, right-click Form1.vb and click Rename
  3. Type PayrollProcessing.vb and press Enter
  4. Design the form as follows:
     
    Payroll Processing
    Control Name Text Other Properties
    GroupBox GroupBox   Employee Identification  
    Label Label   &Employee Name:  
    TextBox TextBox txtEmployeeName   AutoCompleteCustomSource Micheline Hammond
    Paul Bertrand Yamaguchi
    Gertrude Monay
    Ernestine Ngaleu
    Andy Barang
    Christophe Yuen
    Jean Michel Kankan

    AutoCompleteSource: CustomSource

    AutoCompleteMode: Accept

     

    Label Label   Hourly &Salary:  
    TextBox TextBox txtHourlySalary    
    GroupBox GroupBox Payroll Time Frame
    MonthCalendar MonthCalendar calTimeFrame Cursor: Hand
    GroupBox GroupBox   Time Values  
    Label Label   Monday  
    Label Label   Tuesday  
    Label Label   Wednesday  
    Label Label   Thursday  
    Label Label   Friday  
    Label Label   Saturday  
    Label Label   Sunday  
    Label Label   First Week:  
    TextBox TextBox txtMonday1 0.00 TextAlign: Right
    TextBox TextBox txtTuesday1 0.00 TextAlign: Right
    TextBox TextBox txtWednesday1 0.00 TextAlign: Right
    TextBox TextBox txtThursday1 0.00 TextAlign: Right
    TextBox TextBox txtFriday1 0.00 TextAlign: Right
    TextBox TextBox txtSaturday1 0.00 TextAlign: Right
    TextBox TextBox txtSunday1 0.00 TextAlign: Right
    Label Label   Second Week:  
    TextBox TextBox txtMonday2 0.00 TextAlign: Right
    TextBox TextBox txtTuesday2 0.00 TextAlign: Right
    TextBox TextBox txtWednesday2 0.00 TextAlign: Right
    TextBox TextBox txtThursday2 0.00 TextAlign: Right
    TextBox TextBox txtFriday2 0.00 TextAlign: Right
    TextBox TextBox txtSaturday2 0.00 TextAlign: Right
    TextBox TextBox txtSunday2 0.00 TextAlign: Right
    GroupBox GroupBox   Payroll Processing  
    Label Label   Hours  
    Label Label   Amount  
    Button Button btnCalculate Calculate  
    Label Label   Regular  
    TextBox TextBox txtRegularTime 0.00 TextAlign: Right
    TextBox TextBox txtRegularAmount 0.00 TextAlign: Right
    Label Label   Net Pay:  
    TextBox TextBox txtNetPay 0.00 TextAlign: Right
    Label Label   Overtime  
    TextBox TextBox txtOvertime 0.00 TextAlign: Right
    TextBox TextBox txtOvertimeAmount 0.00 TextAlign: Right
    Button Button btnClose    
  5. On the form, double-click the Calculate button and implement its event as follows:
     
    Private Sub btnCalculate_Click(ByVal sender As System.Object, _
                                       ByVal e As System.EventArgs) _
                                       Handles btnCalculate.Click
            Dim Monday1 As Double, Monday2 As Double
            Dim Tuesday1 As Double, Tuesday2 As Double
            Dim Wednesday1 As Double, Wednesday2 As Double
            Dim Thursday1 As Double, Thursday2 As Double
            Dim Friday1 As Double, Friday2 As Double
            Dim Saturday1 As Double, Saturday2 As Double
            Dim Sunday1 As Double, Sunday2 As Double
            
            Dim TotalHoursWeek1 As Double, TotalHoursWeek2 As Double
            Dim RegularHours1 As Double, RegularHours2 As Double
            Dim OvertimeHours1 As Double, OvertimeHours2 As Double
            Dim RegularAmount1 As Double, RegularAmount2 As Double
            Dim OvertimeAmount1 As Double, OvertimeAmount2 As Double
            Dim RegularHours As Double, OvertimeHours As Double
            Dim RegularAmount As Double, OvertimeAmount As Double
            Dim TotalEarnings As Double
    
            Dim HourlySalary As Double
            Dim OvertimeSalary As Double
    
            ' Retrieve the hourly salary
            Try
                HourlySalary = CDbl(txtHourlySalary.Text)
            Catch ex As Exception
                MsgBox("The value you typed for the salary is invalid \n" & _
                    "Please try again")
                txtHourlySalary.Focus()
            End Try
    
            ' Retrieve the value of each day worked
            Try
                Monday1 = CDbl(txtMonday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                         "Please try again")
                txtMonday1.Focus()
            End Try
    
            Try
                Tuesday1 = CDbl(txtTuesday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtTuesday1.Focus()
            End Try
    
            Try
                Wednesday1 = CDbl(txtWednesday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtWednesday1.Focus()
            End Try
    
            Try
                Thursday1 = CDbl(txtThursday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtThursday1.Focus()
            End Try
    
            Try
                Friday1 = CDbl(txtFriday1.Text)
            Catch ex As FormatException
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtFriday1.Focus()
            End Try
    
            Try
                Saturday1 = CDbl(txtSaturday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtSaturday1.Focus()
            End Try
    
            Try
                Sunday1 = CDbl(txtSunday1.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtSunday1.Focus()
            End Try
    
            Try
                Monday2 = CDbl(txtMonday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtMonday2.Focus()
            End Try
    
            Try
                Tuesday2 = CDbl(txtTuesday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtTuesday2.Focus()
            End Try
    
            Try
                Wednesday2 = CDbl(txtWednesday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtWednesday2.Focus()
            End Try
    
            Try
                Thursday2 = CDbl(txtThursday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtThursday2.Focus()
            End Try
    
            Try
                Friday2 = CDbl(txtFriday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtFriday2.Focus()
            End Try
    
            Try
                Saturday2 = CDbl(txtSaturday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtSaturday2.Focus()
            End Try
    
            Try
                Sunday2 = CDbl(txtSunday2.Text)
            Catch ex As Exception
                MsgBox("You typed an invalid value\n" & _
                    "Please try again")
                txtSunday2.Focus()
            End Try
    
            ' Calculate the total number of hours for each week
            TotalHoursWeek1 = Monday1 + Tuesday1 + Wednesday1 + _
                  Thursday1 + Friday1 + Saturday1 + Sunday1
            TotalHoursWeek2 = Monday2 + Tuesday2 + Wednesday2 + _
                Thursday2 + Friday2 + Saturday2 + Sunday2
    
            ' The overtime is paid time and half
            OvertimeSalary = HourlySalary * 1.5
    
            ' If the employee worked under 40 hours, there is no overtime
            If TotalHoursWeek1 < 40 Then
                RegularHours1 = TotalHoursWeek1
                RegularAmount1 = HourlySalary * RegularHours1
                OvertimeHours1 = 0.0
                OvertimeAmount1 = 0.0
                ' If the employee worked over 40 hours, calculate the overtime
            ElseIf TotalHoursWeek1 >= 40 Then
                RegularHours1 = 40
                RegularAmount1 = HourlySalary * 40
                OvertimeHours1 = TotalHoursWeek1 - 40
                OvertimeAmount1 = OvertimeHours1 * OvertimeSalary
            End If
    
            If TotalHoursWeek2 < 40 Then
                RegularHours2 = TotalHoursWeek2
                RegularAmount2 = HourlySalary * RegularHours2
                OvertimeHours2 = 0.0
                OvertimeAmount2 = 0.0
            ElseIf TotalHoursWeek2 >= 40 Then
                RegularHours2 = 40
                RegularAmount2 = HourlySalary * 40
                OvertimeHours2 = TotalHoursWeek2 - 40
                OvertimeAmount2 = OvertimeHours2 * OvertimeSalary
            End If
    
            RegularHours = RegularHours1 + RegularHours2
            OvertimeHours = OvertimeHours1 + OvertimeHours2
            RegularAmount = RegularAmount1 + RegularAmount2
            OvertimeAmount = OvertimeAmount1 + OvertimeAmount2
            TotalEarnings = RegularAmount + OvertimeAmount
    
            txtRegularTime.Text = FormatNumber(RegularHours)
            txtOvertime.Text = FormatNumber(OvertimeHours)
            txtRegularAmount.Text = FormatNumber(RegularAmount)
            txtOvertimeAmount.Text = FormatNumber(OvertimeAmount)
    
            txtNetPay.Text = FormatNumber(TotalEarnings)
    End Sub
  6. Save the file

Using a Month Calendar Control

 

Selecting A Date

As mentioned in our description, the calendar control displays the days of a selected month. The control also displays the remaining days, if any, of the first week of the currently selected month; that is, the days of the previous month that share the week with the first day of the first week of the selected month. The control also displays the first days of the subsequent month that share the week with the last day of the current month.

To use the calendar control, the user can click a date, whether it a date from the current month or a day of the other (previous and next) month. When the user has clicked a date to select it, the control fires a DateSelected event. The DateSelected event is of type DateRangeEventArgs.

The user can also select a date using the keyboard. To do this, the user must first give focus to the control. This is possible by pressing Tab continuously until the control receives focus (or by clicking any date on the control. To select a date using the keyboard, the user can continually press one of the arrow keys (on the keyboard) until the desired date is selected.

You too can programmatically select a date on the calendar control. To do this, assign a valid DateTime value to both the SelectionStart and the SelectionEnd properties. Here is an example:

Imports System.Drawing
Imports System.Windows.Forms

Module Exercise

    Public Class Starter
        Inherits Form

        Private Calendar As MonthCalendar

        Dim components As System.ComponentModel.Container

        Public Sub New()
            InitializeComponent()
        End Sub

        Public Sub InitializeComponent()
            Calendar = New MonthCalendar
            Calendar.Location = New Point(10, 10)

            Controls.Add(Calendar)
        End Sub

        Private Sub FormLoaded(ByVal sender As Object, _
                               ByVal e As EventArgs) _
                               Handles Me.Load
            Calendar.SelectionStart = New DateTime(1988, 12, 5)
            Calendar.SelectionEnd = New DateTime(1988, 12, 5)
        End Sub
    End Class

    Function Main() As Integer

        Dim frmStart As Starter = New Starter

        Application.Run(frmStart)

        Return 0
    End Function

End Module 

When a date has been selected, whether by the user (using the mouse or the keyboard) or by you (through code), the control fires a DateChanged event. The DateChanged event is of type DateRangeEventArgs.

The DateRangeEventArgs class is equipped with two properties: Start and End. When the user clicks a date, these two properties hold the date that was clicked. This means that you can use either of these properties to know the date that was clicked. Both the Start and the End properties are of type DateTime.

Practical LearningPractical Learning: Showing Two Months

  1. In the Class Name combo box, select calTimeFrame
  2. In the Method Name combo box, select DateSelected and implement the event as follows:
     
    Private Sub calTimeFrame_DateSelected(ByVal sender As Object, _
                            ByVal e As System.Windows.Forms.DateRangeEventArgs) _
                            Handles calTimeFrame.DateSelected
            Dim DateStart As DateTime = e.Start
    
            If DateStart.DayOfWeek <> DayOfWeek.Monday Then
                MsgBox("The first day of your time frame must be a Monday")
            End If
    End Sub
  3. Execute the application and try selecting a range of dates
  4. Close the form and return to your programming environment
  5. Display the form

The Date Range Selection

When the user clicks the calendar control, one date is selected. As mentioned in our description, you can give the control the ability to display more than one month. To make this possible, when creating the control, set its width to have enough space. In the same way, you can increase the height to display many months.

To select more than one date, the user can click one date, hold the mouse down, and drag to the left, the right, up or down:

Calendar

The user can also select a range of dates using the keyboard or using a combination of the mouse and the keyboard. To do this, the user must first give focus to the control. To select a range of dates using the keyboard, the user can press and hold Shift, then press one of the arrow keys continually until the last date of the desired range is selected (in reality, we will see that there is a property that controls the maximum range of dates that can be selected). To select a range of dates using a combination of the mouse and keyboard, the user can click the first date, press and hold Shift, then click the last date.

After selecting the days, the starting date is stored in the SelectionStart property. The last date of the selection is stored in the SelectionEnd property. Both properties are of DateTime type. The range of the selected dates is stored in a SelectionRange value. SelectionRange is simply a class that can give you information about the beginning and the end of a selected range of dates.

To programmatically select a date, assign the starting to the SelectionStart property and assign the last date to the SelectionEnd property.

By default, the user can select only up to 7 days at a time. If you want the user to be able to select more or less days than that. Here is an example where the user have selected dates from the 11 to the 20th, that is 10 days:

If you configure the control to display more than one month, the user can select days from one month to another as long as the days are in a range. Here is an example of a calendar that displays two months and the user had selected dates from September 21st, 2007 to October 11th, 2007:

After selecting a range of dates, the control fires a DateChanged event, which is of type DateRangeEventArgs. We saw earlier that the DateRangeEventArgs class has two properties. The DateRangeEventArgs.Start property holds the starting date of the range that the user made. The DateRangeEventArgs.End holds the last date from the range that the user made.

Practical LearningPractical Learning: Showing Two Months

  1. On the form, click the calendar control and drag its right border so it can display two months:
     
  2. Right-click the form and click View Code
  3. Under the previous End Sub line, create the following procedure:
     
    Private Sub EnableForInvalidDate(ByVal Enable As Boolean)
            If Enable = True Then
                txtMonday1.Enabled = True
                txtMonday2.Enabled = True
                txtTuesday1.Enabled = True
                txtTuesday2.Enabled = True
                txtWednesday1.Enabled = True
                txtWednesday2.Enabled = True
                txtThursday1.Enabled = True
                txtThursday2.Enabled = True
                txtFriday1.Enabled = True
                txtFriday2.Enabled = True
                txtSaturday1.Enabled = True
                txtSaturday2.Enabled = True
                txtSunday1.Enabled = True
                txtSunday2.Enabled = True
                txtRegularTime.Enabled = True
                txtRegularAmount.Enabled = True
                txtOvertime.Enabled = True
                txtOvertimeAmount.Enabled = True
                txtNetPay.Enabled = True
                btnCalculate.Enabled = True
            ElseIf Enable = False Then
                txtMonday1.Enabled = False
                txtMonday2.Enabled = False
                txtTuesday1.Enabled = False
                txtTuesday2.Enabled = False
                txtWednesday1.Enabled = False
                txtWednesday2.Enabled = False
                txtThursday1.Enabled = False
                txtThursday2.Enabled = False
                txtFriday1.Enabled = False
                txtFriday2.Enabled = False
                txtSaturday1.Enabled = False
                txtSaturday2.Enabled = False
                txtSunday1.Enabled = False
                txtSunday2.Enabled = False
                txtRegularTime.Enabled = False
                txtRegularAmount.Enabled = False
                txtOvertime.Enabled = False
                txtOvertimeAmount.Enabled = False
                txtNetPay.Enabled = False
                btnCalculate.Enabled = False
            End If
    End Sub
  4. In the Class Name combo box, select calTimeFrame
  5. Change the DateSelected event as follows:
     
    Private Sub calTimeFrame_DateSelected(ByVal sender As Object, _
                            ByVal e As System.Windows.Forms.DateRangeEventArgs) _
                            Handles calTimeFrame.DateSelected
            Dim DateStart As DateTime = e.Start
    
            ' Each payroll will cover 2 weeks
            ' This application assumes that the company started 
            ' implementing the time sheet on January 1st, 2007
            ' Our week day will go from Monday of the first week
            ' to Sunday of the following week
            ' The first date of the time frame must be a Monday
            If DateStart.DayOfWeek <> DayOfWeek.Monday Then
                MsgBox("The first day of your time frame must be a Monday")
                EnableForInvalidDate(False)
                Exit Sub
            Else
                EnableForInvalidDate(True)
            End If
    
            ' Now that the user has selected a date that starts on Monday,
            ' We will check that it corresponds to 
            ' 2 weeks by 2 weeks after January 1st, 2007
            ' To start, we must get the difference of days between 
            ' the selected starting date and January 1st, 2007
            Dim tmDifference As TimeSpan = DateStart.Subtract(New DateTime(2007, 1, 1))
            Dim days As Integer = tmDifference.Days
    
            ' Now that we have the number of days,
            ' this number must be divisible by 14 (2 weeks)
            If (days Mod 14) <> 0 Then
                MsgBox("Invalid starting period - Please try again")
                EnableForInvalidDate(False)
                Exit Sub
            Else
                EnableForInvalidDate(True)
            End If
    
            ' Now that we have a valid starting period, 
            ' let's help the user and select the time period
            Dim range As DateTime = e.Start.AddDays(-1)
            calTimeFrame.SelectionEnd = range.AddDays(14)
    End Sub
  6. In the Class Name combo box, select btnClose
  7. In the Method Name combo box, select Click and implement the event as follows:
     
    Private Sub btnClose_Click(ByVal sender As Object, _
                                   ByVal e As System.EventArgs) _
                                   Handles btnClose.Click
            End
    End Sub
  8. Execute the application and try selecting a range of dates
  9. Close the form and return to your programming environment

The Maximum Date Range Selection

To control the number of days you want the user to be able to select, change the value of the MaxSelectionCount property. The user cannot select more days than the MaxSelectionCount value but the user can select less.

Practical LearningPractical Learning: Set the Maximum Range

  1. Display the form and click the calendar control
  2. In the Properties window, click MaxSelectionCount, type 14, and press Enter
  3. Save the form

Characteristics of a Month Calendar Control

 

Introduction

The calendar control is a rectangular object without a border. After placing it on the form, it displays the current month and only one month. This is because, by default, its width and height are set enough to accommodate only one month.

The Background Color of the Title Bar

To make it a highly visual object, a calendar control uses different colors to represent the background, week days, the background of the title bar, the text of the title bar, the text of the days of the previous month, and the text of the days of the next month.

As mentioned already, the top section of the calendar control displays buttons and labels. By default, these are positioned on top of a blue background. The background color of this section is controlled by the TitleBackColor property Calendar

The Font Color of the Title Bar

Calendar By default, the labels on the title bar display in a white color defined by the ActiveCaptionText system color. The color used to paint the text of the labels of the title bar is controlled by the TitleForeColor property

The Minimum and Maximum Dates

As mentioned already, to change month and subsequently the year of the calendar, the user can click the buttons continuously. By default, the user can navigate from 1/1/1753 to 12/31/9998. If you want to limit the allowable dates beyond which the user should not navigate, use the MinDate and the MaxDate properties. 

The First Day of the Week

Under the title bar, the short names weekdays display, using the format set in Control Panel. In US English, the first day is usually Sunday. If you want to start with a different day, set the value using the FirstDayOfWeek property. The names of weekdays use the same color as the TitleBackColor property. Under the names of the week, there is a horizontal line used as the separator. By default, this line separator is painted in black but it uses the same color as the numeric values of the days of the selected month.

The Background Color of the Calendar

Under the line separator, the numeric days of the month are listed. By default, the numeric days of the control display above a white background which is the Window system color. This color is controlled by the overridden BackColor property.

Calendar

The Font Color of the Days of the Current Month

Calendar The numbers of the days of the month display in two colors. The real days of the selected month display, by default, in a black color as the WindowText system color. The color of these days is controlled by the overridden ForeColor property.

The Font Color of the Days of the Trailing Months

Besides the days of the currently selected month, the calendar control also displays one or more days of the previous month and one or more days of the subsequent month. These are referred to as trailing months or trailing days. These are dayts that don't belong to the currently selected month. These days display in a different color controlled by the TrailingForeColor property. By default, this color is set to GrayText:

Calendar

Of course, you can programmatically change these colors. Although any color is allowed in any category, you should make sure that the calendar is still reasonably appealing and usable.

Practical LearningPractical Learning: Coloring the Month Calendar Control

  1. On the form, click the calendar control
  2. In the Properties window, change the following values:
    BackColor: 255, 192, 128
    ForeColor: Maroon
    TitleBackColor: 192, 64, 0
    TitleForeColor: Yellow
    TrailingForeColor: 255, 255, 192
  3. Save the form

Showing Today

The calendar control is used to let the user know today's date in two ways. On the calendar, today's date is circled by an almost hand-drawn ellipse. In the bottom section of the calendar, today's date is also displayed as a sentence. If you want to display or hide the bottom label, set the ShowToday Boolean property accordingly. For example, to hide it, set this property to false. The presence or absence of this ellipse is controlled by the ShowTodayCircle Boolean property whose default value is True. If you set this property to False, today's would appear without the ellipse:

Calendar

When a new calendar control is added to an application, it assumes today's date. If you want to change this date, use the TodayDate property.

Practical LearningPractical Learning: Hiding Today

  1. On the form, click the calendar control and, in the Properties window, double-click ShowToday to set its value to False
  2. Execute the application to test it
     
    Payroll Processing
  3. Close the form and return to your programming environment

Bold Dates

To accentuate the importance of one or more days of a month, you can bold some days. To bold some days of the calendar, create an array that holds the days. To visually create the list of dates, on the form, click the calendar control. In the Properties window, click BoldDates and click the ellipsis of its field. This would open the DateTime Collection Editor. To add a date member, you can click Add. On the right side, there would be a field named Date. You can type the date or you can click the arrow of the field. This would display a calendar:

DateTime Collection Editor

You can then select a date. In the same way, to complete the array, you can create the other dates you want. After creating the list, you can click OK.

To programmatically create the list of dates, create an array of DateTime values (each member of the array must be a recognizable DateTime value). Once the array is ready, assign it to the BoldDates property.

If you prefer the months bolded, assign the array to the MonthlyBoldedDates property.

 

 

Previous Copyright 2008-2009, yevol.com Next