VB.NET Technology

VB.Net Projects

VB.Net Project 1

DateTimePicker and Month Calendar
Previous Home Next
adplus-dvertising

DateTimePicker

DateTimePicker is ideal for choosing a single date and/or time value and requires the same amount of space as an ordinary drop-down list box. When the user clicks the drop-down button, a month calendar appears. The operation of the control from this point is exactly the same as the MonthCalendar control.

Useful properties

  • BackColor - Indicates the background color of the DateTimePicker control.

  • CustomFormat - Determines the custom date/time format string.

  • DropDownAlign - Determines the alignment of the drop-down calendar on the DateTimePicker control. Takes a value of either Left or Right.

  • ForeColor - Indicates the foreground color of the DateTimePicker control.

  • Format - Determines the format of the date and time displayed in the control.

  • MaxDate - Determines the maximum date and time that can be selected in the control.

  • MaximumDateTime - Gets the maximum date value allowed for the DateTimePicker control.

  • MinDate - Determines the minimum date and time that can be selected in the control.

  • MinimumDateTime - Gets the minimum date value allowed for the DateTimePicker control.

  • ShowCheckBox - Indicates whether a check box is displayed to the left of the selected date.

  • ShowUpDown - Indicates whether a spin button control (also known as an up-down control) is used to adjust the date/time value.

  • Value - Determines the date/time value assigned to the control.

Month Calendar

The MonthCalendar control presents an intuitive graphical interface for users to view and set date information.

Useful properties

  • AnnuallyBoldedDates - Determines the array of DateTime objects that determines which annual days are displayed in bold.

  • BoldedDates - Contains the array of DateTime objects that determines which nonrecurring dates are displayed in bold.

  • CalendarDimensions - Determines the number of columns and rows of months displayed. You can have multiple months displayed horizontally and vertically.

  • FirstDayOfWeek - Determines the first day of the week as displayed in the month calendar. By default, Sunday is shown as the first day of the week.

  • MaxDate - Determines the maximum allowable date.

  • MaxSelectionCount - Determines the maximum number of days that can be selected in a month calendar control.

  • MinDate - Determines the minimum allowable date.

  • MonthlyBoldedDates - Contains the array of DateTime objects that determine which monthly days to bold.

  • SelectionEnd - Determines the end date of the selected range of dates.

  • SelectionRange - Determines the selected range of dates for a month calendar control.

  • SelectionStart - Determines the start date of the selected range of dates.

  • ShowToday - Indicates whether the date represented by the TodayDate property is displayed at the bottom of the control.

  • ShowTodayCircle - Indicates whether today's date is identified with a circle or square.

  • ShowWeekNumbers - Indicates whether the month calendar control displays week numbers (1-52) to the left of each row of days.

  • SingleMonthSize - Gets the minimum size to display one month of the calendar.

  • TitleBackColor - Indicates the background color of the title area of the calendar.

  • TitleForeColor - Indicates the foreground color of the title area of the calendar.

  • TodayDate - Determines the value that is used by MonthCalendar as today's date.

  • TodayDateSet - Gets a value indicating whether the TodayDate property has been explicitly set.

  • TrailingForeColor - Indicates the color of days in months that are not fully displayed in the control.

  • Example

    Code for DateTime Picker Control

    Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, 
    	ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
            label1.Text = "DateTimePicker Date: " + DateTimePicker1.Text
    End Sub
    

    Code for Month Calendar Control

    Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, 
    	ByVal e As System.Windows.Forms.DateRangeEventArgs) 
    	Handles MonthCalendar1.DateChanged
            label2.Text = "Month Calender Date :  " & MonthCalendar1.SelectionStart.ToLongDateString()
    End Sub
    
    Previous Home Next