Professional Documents
Culture Documents
X
Form1
Sretch
ShowTodayCircle Obtains or sets a value indicating whether the month calendar control displays week
numbers
SingleMonthSize Returns the minimum size to display a month
Obtains or sets the size of the MonthCalendar control
Size
Text
Obtains or sets the text to be displayed on the MonthCalendar control
TitleBackColor Obtains or sets the back color of the title area of the calendar
TitleForeColor Obtains or sets the fore color of the title area of the calendar
UpdateBoldedDates
261
Chapter 7
DataChanged
DateSelected
Occurs when the user clicks the
Occurs when the date in the calendar
BackgroundImageLayout property changes
MonthCalendar control
control changes
Occurs when a date is selected in the calendar
DoubleClick Occurs when the user double-clicks the
IneModeChanged Occurs when the ImeMode property changes MonthCalendar control
MouseClick Oocurs when the user clicks the
MouseDoubleClick Occurs when the user
MonthCalendar control with the mo
mouse
double-clicks the MonthCalendar control with
the
PaddingChanged Occurs when the Padding property changes
Paint
Occurs when the control is redrawn
RightToLe ftLayoutChanged Occurs when the value of the RightToLe
TextChanged Occurs when the value of the Text property
ftLayout
property changes
changes
The DateTimePicker Control
The DateTimePicker control is used to display the date
and time. You can select the date from the
DateTimePicker control by clicking the arrow button in this control, it displays a month
select the date from the displayed calendar by clicking calendar. You can
selected date display in the text box part of the the required date. Once you select the date, the
DateTimePicker
You can limit the date and time that can be selected in a control, and a ValueChanged event raIse.
Maxbate properties. You can even change the look ofDateTimePicker control by setting the MinDate anu
the control by setting the
CalendarFont, CalendarTitleBackColor, CalendarForeColor, and
BackColorChanged
BackgroundImage Changed
Occurs when the value of the BackColor property is changed
Occurs when the BackgroundImage property is changed
Eackground Image LayoutChanged Occurs when the value of the BackgroundImageLayout property changes
Click Occurs when a user clicks the control
CloseUp Occurs when the user is finished selecting the date from the drop-down
calendar
EorEormeColatCohanged
rChanged Occurs when the value of the ForeColor property is changed on the control
Occurs when the value of the Fo rmat property changes
MouseClick Occurs when a user clicks the control with the mouse
Mous
PaddineDoubl
gChangedeClick
Occurs when a user double-clicks the control with the mouse
Occurs when the value of the Padding property is changed
263
Chapter7
Fernl
Properties
Ppyn Forml Systen Wndows
Racn Fo
A21s
Se 473, 355
February. 2011 Frday Februay 11, 2011D SzeGy Aute
Sun Mon Tue Wed Thu Fe Sat StartPe WndowsDe
1 2 Tae
6 Seing a Date in Date Time Plder Tat Forml
9 10 12
3 4 15 16 17 18 19
24 Text
The tert usociated with
Retavrg a Dote frum Dte Trme the control
Teday 211/2011
Sohution Exrloret
Sohuton MoathCalend
4Month CalendarA
SnpC My Project
EForml vb
Tadar
Toei
264
Windows Forms Controls- Il|
Generatethe DateSelected event of the MonthCalendar control and add the following code snippet in the
1
monthCalendar1 DateSelected event:
Private Sub McMonthcal1endarl1_DateSelected (ByVal sender As System.object, Byval e As
windows. Forms..DateRangeEventArgs) Handles Monthcalendarl.Dateselected
System.TextBOx1. Text ="Days of month selected: "8
Monthcallendar1. selecti onRange.Start. Day
End Sub
we are displaying the selected date in a text box, when the user selects a date on
preceding code snippet,runtime.
Inthe control at
the MonthCalendar month is
the application and select a date on the MonthCalendar control. The day of the selected
Figure 7.17:
displayed in the text box,as shown in
3
B Form1
265
Chapter 7
5/25/2011 12-00-00 AM
OK
H- Represents the one- or hour in 12-hour format. Note that single-digit values are zero
HH- Represents the two-digit hour in 24-hour format precededbya
two-digit hour in 24-hour format. Note that single-digit values are
m- Represents the one- or
two-digit minute
mm- Represents the two-digit minute. Note that single-digit values are preceded bya zero
266