Using the UpDown Control
The UpDown control is an excellent tool for incrementing and decrementing values. Used in conjunction with other controls, it can easily act as a means to increment and decrement the other controls' values. For example, on the frmCalendar form, UpDown objects increment and decrement the selected day, month, and year. Like the Calendar control, the UpDown object has its own built-in properties and methods. Although you can modify the properties on the Other tab of the Properties window, it's easier to modify them by using the UpDown properties dialog box (see Figure 21.12). To open it, double-click on the UpDown object whose properties you want to modify.
Figure 21.12. The UpDown Properties dialog box.

The Orientation property, one of the most important for the UpDown object, indicates whether you want the UpDown object to be displayed vertically or horizontally. The two most commonly used events of an UpDown object are the UpClick event and the DownClick event; they specify what happens when the user clicks either button of the control. The following code is placed in the DownClick event of the updnDay UpDown object on frmCalendar. Notice that the code executes a PreviousDay method on the calPickADay control, causing the Calendar control to set the focus to the previous day:Private Sub updnDay_DownClick()
'Move selected day back one day
calPickADay.PreviousDay
End Sub
The UpClick event of the updnDay control uses the NextDay method of the calPickADay control to cause the focus to shift to the next day:Private Sub updnDay_UpClick()
'Move selected day forward one day
calPickADay.NextDay
End Sub
The DownClick event of the updnMonth control uses the Calendar control's PreviousMonth method to move focus to the same day in the previous month:Private Sub updnMonth_DownClick()
'Move selected day back one month
calPickADay.PreviousMonth
End Sub
The UpClick event of the updnMonth control uses the Calendar control's NextMonth method to move focus to the same day in the next month:Private Sub updnMonth_UpClick()
'Move selected day forward one month
calPickADay.NextMonth
End Sub
The DownClick and UpClick events of the updnYear control use the Calendar control's PreviousYear and NextYear methods to move backward and forward a year in the calendar:Private Sub updnYear_DownClick()
'Move selected day back one year
calPickADay.PreviousYear
End Sub
Private Sub updnYear_UpClick()
'Move selected day forward one year
calPickADay.NextYear
End Sub
As you can see, by combining the different ActiveX controls, you can create exciting, user-friendly, and useful applications.