Animation Control

The Animation control allows you to create buttons which display animations, such as .avi files, when clicked. The control can play only AVI files that have no sound. In addition, the Animation control can display only uncompressed.avi files or .avi files that have been compressed using Run-Length Encoding (RLE).

Remarks

If you attempt to load an .avi file that includes sound data or that is in a format not supported by the control, an error (error 35752) is returned.

An example of this control is the file copy progress bar in Windows 95, which uses an Animation control. Pieces of paper "fly" from one folder to another while the copy operation executes.


DateTimePicker Control

The DateTimePicker control enables you to provide a formatted date field that allows easy date selection. In addition, users can select a date from a dropdown calendar interface similar to the MonthView control.

Syntax

DTPicker

Remarks

The DateTimePicker control, operates in two modes:

  • Dropdown Calendar mode (default) – enables the user to display a dropdown calendar that can be used to select a date.

  • Time Format mode – enables the user to select a field in the date display (i.e. the month, day, year, etc.) and press the up/down arrow to the right of the control to set its value.

You can customize the appearance of the drop-down calendar of the control. Various color attributes such as CalendarBackColor, CalendarForeColor, CalendarTitleBackColor, CalendarTitleForeColor and CalendarTrailingForeColor enable you to create a unique color scheme.

The control can be navigated using either the keyboard or mouse. The drop-down calendar has two buttons that enable you to scroll months in and out of view.

Note The DateTimePicker control is part of a group of ActiveX controls that are found in the MSCOMCT2.OCX file. To use the DateTimePicker control in your application, you must add the MSCOMCT2.OCX file to the project. When distributing your application, install the MSCOMCT2.OCX file in the user's Microsoft Windows System or System32 directory. For more information on how to add an ActiveX control to a project, see "Adding Controls to a Project" in the Programmer's Guide.


FlatScrollBar Control

The FlatScrollBar control is a mouse-sensitive version of the standard Windows scroll bar that offers two-dimensional formatting options. It can also replace the standard Windows three-dimensional scroll bar. The FlatScrollBar provides increased interactivity when using the scroll arrows and the scroll box.

Syntax

FlatScrollBar

Remarks

The FlatScrollBar provides you with three formatting options.

  • A two-dimensional appearance that duplicates the look of the scroll bar found in Internet Explorer 4.0. The scroll arrows and the scroll bar thumb are mouse sensitive; they change color in response to the mouse pointer passing over them.

  • A two-dimensional appearance that becomes three-dimensional in response to the mouse pointer. The scroll arrows and thumb are beveled when the pointer passes over them. This reproduces the look of the scrollbar seen in Microsoft Encarta Encyclopedia.

  • An appearance identical to that of a standard three-dimensional Windows scroll bar. Three-dimensional mode does not have mouse-sensitive features.

With the FlatScrollBar you can disable either of the scroll arrows, this provides additional feedback to the user as an indication to scroll in a particular direction based on other factors in the program.

The FlatScrollBar can serve as either a horizontal or a vertical scrollbar depending on you set its Orientation property.

Distribution Note The FlatScrollBar control is part of a group of ActiveX controls that are found in the MSCOMCT2.OCX file. To use the FlatScrollBar control in your application, you must add the MSCOMCT2.OCX file to the project. When distributing your application, install the MSCOMCT2.OCX file in the user's Microsoft Windows System or System32 directory. For more information on how to add an ActiveX control to a project, see "Adding Controls to a Project" in the Programmer's Guide.


MonthView Control

The MonthView control enables you to create applications that let users view and set date information via a calendar-like interface.

Syntax

MonthView

Remarks

The Value property of the MonthView control returns the currently selected date.

You can allow end users to select a contiguous range of dates by setting the MultiSelect property to True, and specifying the number of selectable days with the MaxSelProperty. The SelStart and SelEnd properties return the start and end dates of a selection.

You can customize a MonthView control's appearance in many ways. Various color attributes such as MonthBackColor, TitleBackColor, TitleForeColor and TrailingForeColor enable you to create a unique color scheme for the control.

You can display more than one month at a time (up to 12) in a MonthView control by setting the MonthRows and MonthColumns properties. The total of the MonthRows and MonthColumns properties must be less than or equal to 12.

Note The MonthView control is part of a group of ActiveX controls that are found in the MSCOMCT2.OCX file. To use the MonthView control in your application, you must add the MSCOMCT2.OCX file to the project. When distributing your application, install the MSCOMCT2.OCX file in the user's Microsoft Windows System or System32 directory. For more information on how to add an ActiveX control to a project, see "Adding Controls to a Project" in the Programmer's Guide.


UpDown Control

An UpDown control has a pair of arrow buttons which the user can click to increment or decrement a value, such as a scroll position or a value in an associated control, known as a buddy control.

Syntax

UpDown

Remarks

To the user, an UpDown control and its buddy control often look like a single control. The buddy control can be any control that can be linked to the UpDown control through the BuddyControl property, and usually displays data, such as a TextBox control or a CommandButton control.

Note Lightweight windowless controls, such as the intrinsic label control, can't be used as a buddy control.

By setting the AutoBuddy property, the UpDown control automatically uses the previous control in the tab order as its buddy control. If there is no previous control in the tab order, the UpDown control will use the next control in the tab order as its buddy control. Another way to set the buddy control is with the BuddyControl property. At design time, when either the AutoBuddy property or the BuddyControl property is set, the buddy control will automatically pair up with the UpDown control by sizing and positioning next to it. The UpDown control can be positioned to the right or left of its buddy control with the Alignment property.

The Increment, Min, Max, and Wrap properties specify how the UpDown control's Value property changes when the user clicks the buttons on the control. For example, if you have values that are multiples of 10, and range from 20 to 80, you can set the Increment, Min, and Max properties to 10, 20, and 80, respectively. The Wrap property allows the Value property to increment past the Max property and start again at the Min property, or vice versa.

An UpDown control without a buddy control functions as a sort of simplified scroll bar.

Note The UpDown control should be used in place of the Spin Button control from Visual Basic 4.0.

Distribution Note The UpDown control is part of a group of ActiveX controls that are found in the MSCOMCT2.OCX file. To use the UpDown control in your application, you must add the MSCOMCT2.OCX file to the project. When distributing your application, install the MSCOMCT2.OCX file in the user's Microsoft Windows SYSTEM directory. For more information on how to add a custom control to a project, see the Programmer's Guide.


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    Remedy: Insert the MSDN Library CD into the CD-ROM drive.


Error Constants (ComCtl32)

Constant | Value | Description
cc2InvalidProcedureCall | 5 | Invalid procedure call
cc2BadFileNameOrNumber | &H34 | Bad file name or number
cc2FileNotFound | &H35 | File not found
cc2InvalidPropertyValue | &H17C | Invalid property value
cc2SetNotSupportedAtRuntime | &H17E | Property cannot be set at run time
cc2SetNotSupported | &H17F | Property is read-only
cc2InvalidObjectUse | &H1A9 | Invalid object use
cc2WrongClipboardFormat | &H1CD | Specified format doesn't match format of data
cc2DataObjectLocked | &H2A0 | DataObject formats list may not be cleared or expanded outside of the OLEStartDrag event
cc2ExpectedAnArgument | &H2A1 | Expected at least one argument.
cc2RecursiveOleDrag | &H2A2 | Illegal recursive invocation of OLE drag and drop
cc2FormatNotByteArray | &H2A3 | Non-intrinsic OLE drag and drop formats used with SetData require Byte array data. GetData may return more bytes than were given to SetData.
cc2DataNotSetForFormat | &H2A4 | Requested data was not supplied to the DataObject during the OLESetData event.
cc2InconsistentObject | &H8BA6 | Internal state of the control has become corrupted
cc2ErrorDuringSet | &H8BA7 | Unable to set property
cc2ErrorOpeningVideo | &H8BA8 | Unable to open AVI file
cc2ErrorPlayingVideo | &H8BA9 | Unable to play AVI file
cc2NoValidBuddyCtl | &H8BAA | BuddyControl property must be set first
cc2VideoNotOpen | &H8BAB | Must open AVI file first
cc2AutoBuddyNotSet | &H8BAC | AutoBuddy not set, no potential buddy controls found
cc2ErrorStoppingVideo | &H8BAD | Error trying to stop playing AVI file
cc2ErrorClosingVideo | &H8BAE | Error closing open AVI file
cc2CantStopAutoPlay | &H8BAF | Stop method does not effect AutoPlay property
cc2BuddyNotASibling | &H8BB0 | BuddyControl must be a separate control within the same container
cc2NoUpDownAsBuddy | &H8BB1 | An UpDown control cannot be buddied with another UpDown control


BuddyProperty Property

Sets or returns the property used to synchronize the UpDown control with its buddy control.

Syntax

object.BuddyProperty [= value]

The BuddyProperty property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A variant value that specifies a property of the control specified by the BuddyControl property. If no value is specified, the default property for the control is used.

Remarks

If the SyncBuddy property is True, the control will synchronize its Value property with the property specified by the BuddyProperty property.

The BuddyProperty can be set at design time by selecting the property out of a drop down list in the Properties window.

The BuddyControl property must be set before setting the BuddyProperty property, or an error results.


CallbackKeyDown Event

Occurs when a key is pressed while the cursor is inside a callback field.

Syntax

Private Sub object_CallbackKeyDown([index As Integer], KeyCode As Integer, Shift As Integer, CallbackField As String, CallbackDate As Date)

The CallbackKeyDown event syntax has these parts:

Part | Description
Object | An object expression that evaluates to an object in the Applies To list.
Index | An integer that uniquely identifies a control if it's in a control array.
KeyCode | A numeric expression that specifies the ASCII key code of the key that was pressed.
Shift | A numeric expression that specifies the state of the SHIFT, CTRL and ALT keys at the time of the event.
CallbackField | A string expression specifying the callback substring.
CallbackDate | A date expression specifying the date value of the control.

Remarks

The CallbackKeyDown event is a variation on the KeyDown event, and can be used to process a callback substring.

See CustomFormat Property for more information on callback processing.

The event also occurs when the user presses the up and down arrow keys


Change Event (UpDown Control)

This event occurs when the Value property is changed.

Syntax

Private Sub object_Change([index as integer])

The Change event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.

Remarks

The Change event occurs whenever the Value property changes. The Value property can change through code, by clicking the arrow buttons, or by changing the value in a buddy control when the SyncBuddy property is True.


CloseUp Event

Occurs when the drop-down calendar is closed.

Syntax

Private Sub object_CloseUp([index As Integer])

The CloseUp event syntax has these parts:

Part | Description
Object | An object expression that evaluates to an object in the Applies To list.
Index | An integer that uniquely identifies a control if it's in a control array.

Remarks

The CloseUp event can be used to respond to the user closing the drop-down calendar.


DateClick Event

Occurs when a date on the control is clicked.

Syntax

Private Sub object_DateClick([index As Integer], DateClicked As Date)

The DateClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.
DateClicked | A date expression specifying the date that was clicked.

Remarks

The DateClick event can be used to respond to the user clicking on a particular date. The DateClicked can be used to determine which date was clicked.


DateDblClick Event

Occurs when a date on the control is double-clicked.

Syntax

Private Sub object_DateDblClick([index As Integer], DateDblClicked As Date)

The DateDblClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.
DateDblClicked | A date expression specifying the date that was clicked.

Remarks

The DateDblClick event can be used to respond to the user double-clicking on a particular date. The DateDblClicked can be used to determine which date was double-clicked.


DownClick Event

This event occurs when the down or left arrow button is clicked.

Syntax

Private Sub object_DownClick([index as integer])

The DownClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.

Remarks

The DownClick event occurs after the Change event.


DropDown Event (DateTimePicker Control)

Occurs when the dropdown calendar is about to drop down.

Syntax

Private Sub object_DropDown()

The object placeholder represents an object expression that evaluates to an object in the Applies To list.


Format Event (DateTimePicker Control)

Occurs when the control requests text to be displayed in a callback field.

Syntax

Private Sub object_Format([index As Integer], CallbackField As String, FormattedString As String)

The Format event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.
CallbackField | A string expression specifying the callback substring.
FormattedStringField | A string expression specifying the formatted string that is to be displayed.

Remarks

The Format event is used to set the text to be displayed in a callback field.

See CustomFormat Property for more information on callback processing.


CustomFormat Property, Format Event, FormatSize Event Example

The example displays the current date with the Spanish month name in parentheses. The CallbackField "XXXX" is set in the Load event by setting the CustomFormat property to a string that includes the four "X"s. The FormatSize event once before the Forma event and is used to determine the size of the callback field. The Format event then occurs which returns a formatted string to replace the callback field text. To try the example, place a DateTimePicker control on a form and paste the code into the Declarations section.

Option Base 1
Private sSpanishMonthLong(12) As String

Private Sub DTPicker1_Format(ByVal CallbackField As String, FormattedString As String)
   If CallbackField = "XXXX" Then
      FormattedString = sSpanishMonthLong(DTPicker1.Month)
   End If
End Sub

Private Sub DTPicker1_FormatSize(ByVal CallbackField As String, Size As Integer)
   Dim iMaxMonthLen As Integer

   If CallbackField = "XXXX" Then
      iMaxMonthLen = 0
      For i = 1 To 12
         If iMaxMonthLen < Len(sSpanishMonthLong(i)) Then
            iMaxMonthLen = Len(sSpanishMonthLong(i))
         End If
      Next
   End If
   Size = iMaxMonthLen
End Sub

Private Sub Form_Load()
   DTPicker1.CustomFormat = "MMMM(XXXX) dd, yyy"
   DTPicker1.Format = dtpCustom

   sSpanishMonthLong(1) = "Enero"
   sSpanishMonthLong(2) = "Febrero"
   sSpanishMonthLong(3) = "Marzo"
   sSpanishMonthLong(4) = "Abril"
   sSpanishMonthLong(5) = "Mayo"
   sSpanishMonthLong(6) = "Junio"
   sSpanishMonthLong(7) = "Julio"
   sSpanishMonthLong(8) = "Agosto"
   sSpanishMonthLong(9) = "Septiembre"
   sSpanishMonthLong(10) = "Octubre"
   sSpanishMonthLong(11) = "Noviembre"
   sSpanishMonthLong(12) = "Diciembre"
End Sub


FormatSize Event

Occurs after the CustomFormat property changes, and before the Format event occurs. The event allows you to set the maximum allowable size of the formatted string so the control can be painted in the screen with ample space for the user-formatted string.

Syntax

Private Sub object_FormatSize([index As Integer], CallbackField As String, Size As Long)

The FormatSize event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.
CallbackField | A string expression specifying the callback substring.
Size | A long integer specifying the size of the string that will be returned in the Format event.

Remarks

The FormatSize event is used to set the size of the text to be displayed in a callback field.


GetDayBold Event

Occurs when the control needs to display a date, in order to get bold information.

Syntax

Private Sub object_GetDayBold([index As Integer], StartDate As Date, Count As Integer, State( ) As Array)

The DateDblClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.
StartDate | A date expression specifying the first date that is displayed.
Count | A numeric expression specifying the number of days that are displayed.
State( ) | An array of boolean values that specify if a date is bold.

Remarks

The GetDayBold event can be used to set the boldness of days as they are brought into view.


GetDayBold Event Example

The following code sets all Fridays to bold. To try the example, place a MonthView control on a form, and paste the code into the Declarations section. Then run the project.

Private Sub MonthView1_GetDayBold(ByVal StartDate As Date, ByVal Count As Integer, State() As Boolean)
   ' Presuming the start of the week is Sunday, set the variable intBold
   ' to the fifth Friday).  Then set the State of
   ' every Friday to True.
   Dim intBold As Integer
   intBold = mvwFriday
   While intBold < Count
      State(intBold - 1) = True
      intBold = intBold + 7
   Wend
End Sub


SelChange Event (MonthView Control)

Occurs when the user selects a new date or range of dates.

Syntax

Private Sub object_SelChange(StartDate As Date, EndDate As Date, Cancel As Boolean)

The SelChange Event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
StartDate | The first date in the selection.
EndDate | The last date in the selection
Cancel | Determines whether the selection is canceled.


SelChange Event Example

The example prints out the range of dates selected by the user. To try the example, place a MonthView control on a form and paste the code into the Declarations section of the code module. Start the project and select various date ranges (set the MultiSelect property to True).

Private Sub MonthView1_SelChange(ByVal StartDate As Date, ByVal EndDate As Date, Cancel As Boolean)
   Dim d As Date
   d = StartDate
   Debug.Print "Start"
   While d <= EndDate
      Debug.Print d
      d = d + 1
   Wend
   Debug.Print "End"
End Sub


UpClick Event

This event occurs when the up or right arrow button is clicked.

Private Sub object_UpClick([index as integer])

The UpClick event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer that uniquely identifies a control if it's in a control array.

Remarks

The UpClick event occurs after the Change event.


Trappable Errors for the Windows Common Controls (ComCtl2)

The following tables list the trappable errors and constants for the Windows Common Controls in the MSComct2.OCX file.

The following are the errors for the Windows Common Controls located in the MSComct2.OCX file. Controls included in this file are: Animation, DateTimePicker, FlatScrollBar, MonthView, and UpDown.

Constant | Value | Description
cc2InvalidProcedureCall | 5 | Invalid procedure call.
cc2BadFileNameOrNumber | 52 | Bad file name or number.
cc2FileNotFound | 53 | File not found.
cc2InvalidPropertyValue | 380 | Invalid property value.
cc2SetNotSupportedAtRuntime | 382 | Property cannot be set at runtime.
cc2SetNotSupported | 383 | Property is read-only.
cc2GetNotSupported | 394 | Property is write-only.
cc2InvalidObjectUse | 425 | Invalid object use.
cc2WrongClipboardFormat | 461 | Specified format doesn't match format of data.
cc2DataObjectLocked | 672 | DataObject formats list may not be cleared or expanded outside of the OLEStartDrag event.
cc2ExpectedAnArgument | 673 | Expected at least one argument.
cc2RecursiveOleDrag | 674 | Illegal recursive invocation of OLE drag and drop.
cc2FormatNotByteArray | 675 | Non-intrinsic OLE drag and drop formats used with SetData require byte array data. GetData may return more bytes than were given to SetData.
cc2DataNotSetForFormat | 676 | Requested data was not supplied to the DataObject during the OLESetData event.
cc2InconsistentObject | 35750 | Internal state of the control has become corrupted.
cc2ErrorDuringSet | 35751 | Unable to set property.
cc2ErrorOpeningVideo | 35752 | Unable to open AVI file.
cc2ErrorPlayingVideo | 35753 | Unable to play AVI file.
cc2NoValidBuddyCtl | 35754 | BuddyControl property must be set first.
cc2VideoNotOpen | 35755 | Must open AVI file first.
cc2AutoBuddyNotSet | 35756 | AutoBuddy not set, no potential buddy controls found.
cc2ErrorStoppingVideo | 35757 | Error trying to stop playing video file.
cc2ErrorClosingVideo | 35758 | Error closing open video file.
cc2CantStopAutoPlay | 35759 | Stop method does not effect AutoPlay property.
cc2BuddyNotASibling | 35760 | BuddyControl must be a separate control within the same container.
cc2NoUpDownAsBuddy | 35761 | An UpDown control cannot be buddied with another UpDown control.
cc2InvalidRange | 35770 | An invalid date range was specified.
cc2InvalidMaxDate | 35771 | An invalid date was specified for the MaxDate property.
cc2InvalidMinDate | 35772 | An invalid value was specified for the MinDate property.
cc2DateOutOfRange | 35773 | A date was specified that doesn't fall within the MinDate and MaxData properties.
cc2InvalidMaxDateMin | 35774 | A value was specified for the MaxDate property that is lower than the current value of MinDate.
cc2InvalidMinDateMax | 35775 | A value was specified for the MinDate property that is higher than the current value of MaxDate.
cc2InvalidRowColValue | 35776 | A value was specified for MonthRows or MonthColumns that is not between 1 and 12.
cc2InvalidRowColTotal | 35777 | A value was specified for MonthRows that would cause the total number of months (ie. MonthRows * MonthCols) to be greater than 12.
cc2MonthViewError | 35778 | An error occurred in a call to the Windows MonthView control.
cc2SetDayMultiSelectOn | 35779 | Can't set Day property when MultiSelect = True.
cc2SetDayOfWeekMultiSelectOn | 35780 | Can't set DayOfWeek property when MultiSelect = True.
cc2SetMonthMultiSelectOn | 35781 | Can't set Month property when MultSelect = True.
cc2SetWeekMultiSelectOn | 35782 | Can't Set Week property when MultiSelect = True.
cc2SetYearMultiSelectOn | 35783 | Can't set Year property when MultiSelect = True.
cc2SetMaxSelCountMultiSelectOff | 35784 | Can't set MaxSelCount property when MultiSelect = False.
cc2SetSelEndMultiSelectOff | 35785 | Can't set SelEnd property when MultiSelect = False.
cc2SetSelStartMultiSelectOff | 35786 | Can't set SelStart property when MultiSelect = False.
cc2NullValueNotAllowed | 35787 | Can't set Value to NULL when CheckBox property = FALSE.
cc2DTPickerError | 35788 | An error occurred in a call to the Windows DTPicker control.
cc2ScrollValueOutOfRange | 35789 | Scroll value is out of range.


Close Method (Animation Control)

The Close method causes the Animation control to close the currently open AVI file. If there was no file loaded, Close does nothing, and no error is generated

Syntax

object.Close

The object placeholder represents an object expression that evaluates to an Animation control.

Remarks

To stop a file from playing, use the Stop method. However, if the Autoplay property is set to True, set Autoplay to False to stop the file from playing.


ComputeControlSize Method

Returns the width and height of a MonthView control for a given number of rows and columns.

Syntax

object.ComputeControlSize(Rows, Columns, Width, Height)

The ComputeControlSize method syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
Rows | Sets an integer specifying the number of rows.
Columns | Sets an integer specifying the number of columns.
Width | Returns a single-precision number that is the width of the prospective control.
Height | Returns a single-precision number that is the height of the prospective control.

Remarks

When the size of the MonthView control changes by resetting the MonthColumns or MonthRows properties, use the ComputeControlSize method to calculate the size of the control before the change, and resize the form accordingly.

To use the ComputeControlSize method, first declare two variables as type Single. Then invoke the method with the variables as the Width and Height arguments.


ComputeControlSize Method Example

The example uses the ComputeControlSize method to calculate how large a MonthView control will be after increasing it's size using the MonthRows and MonthColumns properties. To try the example, place a MonthView control on a form and paste the code into the Declarations section of the code module. Start the project and double-click the form.

Private Sub Form_Load()
   ' Set the Top and Left properties of the control.
   With MonthView1
      .Left = 200 ' Assuming ScaleMode = Twip
      .Top = 400
   End With
End Sub

Private Sub Form_DblClick()
   Dim sWidth As Single
   Dim sHeight As Single

   With MonthView1 ' Compute the control size and add columns and rows.
      .ComputeControlSize 3, 4, sWidth, sHeight
      .MonthColumns = 4
      .MonthRows = 3  '
   End With

   ' Resize the contorl using the values from the method.
   Me.Width = MonthView1.Left + sWidth + 500
   Me.Height = MonthView1.Top + sHeight + 500
End Sub


HitTest Method (MonthView Control)

Returns the date located at a particular set of coordinates. Most often used with drag-and-drop operations to determine if a drop target item is available at the present location.

Syntax

object.HitTest(x as Single, y As Single, Date As Date)

The HitTest method syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
x, y | Coordinates of a target date.
Date | A date expression returned when a mouse operation occurs over a date on the control.

Return Settings

The HitTest method returns the following values which specify the part of the calendar over which the mouse pointer is hovering:

Constant | Value | Description
mvwCalendarBack | 0 | The calendar background.
mvwCalendarDate | 1 | Calendar date.
mvwCalendarDateNext | 2 | When this area is clicked, the calendar displays the following month.
mvwCalendarDatePrev | 3 | When this area is clicked, the calendar displays the previous month.
mvwCalendarDay | 4 | The day labels above the dates.
mvwCalendarWeekNum | 5 | The week number, if ShowWeekNumbers is set to True.
mvwNoWhere | 6 | Bottom edge of the calendar.
mvwTitleBack | 7 | Background of the calendar.
mvwTitleBtnNext | 8 | The Next button in the title area.
mvwTitleBtnPrev | 9 | The Previous button in the title area.
mvwTitleMonth | 10 | The month string in the title.
mvwTitleYear | 11 | The year string in the title.
mvwTodayLink | 12 | When this area is clicked, the calendar displays the current month and day. Only available if ShowToday is set to True.

Remarks

The HitTest method can be used to determine what area of the calendar is being affected by a mouse operation.

If no date exists at the specified coordinates, the HitTest method returns Null. The Date will also be Null if no date exists at the coordinates.


HitTest Method (MonthView Control) Example

This example uses the HitTest method to display the date in a label control as the mouse passes over it. To try the example, place MonthView and Label controls on a form. Then paste the following code into the Declarations section.

Private Sub MonthView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim iResult As Integer
   Dim dtMyDate As Date
   iResult = MonthView1.HitTest(x, y, dtMyDate)
   Label1.Caption = dtMyDate
End Sub


Open Method (Animation Control)

Opens an .avi file to play. If the AutoPlay property is set to True, then the clip will start playing as soon as it is loaded. It will continue to repeat until the .avi file is closed or the Autoplay property is set to False.

Syntax

object.Open file

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
file | Required. The name of the file to play.

Remarks

The Animation control cannot play .avi files that include sound data. In addition, the Animation control can display only uncompressed .avi files or .avi files that have been compressed using Run-Length Encoding (RLE). An error will be returned when the Open method is invoked with a file that includes sound data or that is in an unsupported compression format.


Open Method (Animation Control) Example

The following example opens an .avi file by using the Open Dialog, and begins playing it automatically. To try the example, place an Animation control and a CommonDialog control on a form, and paste the code into the form's Declarations section. Run the example, and choose an .avi file to open.

Private Sub Animation1_Click ()
   With CommonDialog1
      .Filter = "avi (*.avi)|*.avi"
      .ShowOpen
   End With
   With Animation1
      .Autoplay = True
      .Open CommonDialog1.Filename
   End With
End Sub


Play Method

Plays an .avi file in the Animation control.

Syntax

object.Play [= repeat, start, end]

Part | Description
object | Required. An object expression that evaluates to an Animation control.
Repeat | Optional. Integer that specifies the number of times the clip will be repeated. The default is -1, which causes the clip to repeat indefinitely.
Start | Optional. Integer that specifies the starting frame. The default value is 0, which starts the clip on the first frame. The maximum value is 65535.
end | Optional. Integer that specifies the ending frame. The default value is -1, which indicates the last frame of the clip. The maximum value is 65535.

Data Type

Integer

Remarks

Use the Stop method to stop an .avi file from playing.


Stop Method (Animation Control)

Stops the play of an .avi file in the Animation control.

Syntax

object.Stop

The object placeholder represents an object expression that evaluates to an Animation control.

Remarks

The Stop method stops only an animation that was started with the Play method. Attempting to use the Stop method when the Autoplay property is set to True returns an error (35759).


Alignment Property (UpDown Control)

Returns or sets a value that determines the alignment of the UpDown control with its buddy control.

Syntax

object.Alignment [= value]

The Alignment property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A value that specifies the alignment of the UpDown control with its buddy control, as described in Settings.

Settings

The settings for value are:

Constant | Value | Description
cc2alignmentLeft | 0 | The UpDown control is aligned to the left of its buddy control.
cc2alignmentRight | 1 | (Default). The UpDown control is aligned to the right of its buddy control.

Remarks

Use the Alignment property to specify the positioning of the UpDown control next to its buddy control. By default, the UpDown control is displayed on the right side of the buddy control.

Setting the Alignment property automatically realigns the UpDown control with its buddy control. The buddy control's width is reduced by the width of the UpDown control, so that the overall width of the two controls is the same as the buddy control was alone.

Note The Alignment property ignores the Orientation property when aligning to the UpDown control.


Appearance Property (FlatScrollBar Control)

Returns or sets the appearance of a FlatScrollBar control

Syntax

object.Appearance [= integer]

The Appearance property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | A numeric expression specifying the style of the scroll bar, as described in Settings.

Settings

The settings for integer are:

Constant | Value | Description
fsb3D | 0 | Scroll bar will have the three-dimensional appearance of a standard Windows scroll bar.
fsbFlat | 1 | (Default) Scroll bar will appear two-dimensional.
fsbTrack3D | 2 | Scroll bar will appear two-dimensional, with the thumb and arrow buttons becoming three-dimensional when the mouse passes over them.

Remarks

The Appearance property sets the look of the scroll bar, and determines whether it will be 2-D, 3-D, or a combination. The combination scroll bar changes the scroll arrows and thumb from 2-D to 3-D in response to the mouse pointer, and lets you create a dynamic interface.


Arrows Property

Returns or sets a value that determines which scroll arrows will be enabled.

Syntax

object.Arrows [= integer]

The Arrows property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | A numeric expression specifying the enabled scroll button or buttons, as described in Settings.

Settings

The settings for integer are:

Constant | Value | Description
cc2Both | 0 | (Default) Both the left and right (or up and down, depending on Orientation) scroll arrows will be enabled.
cc2LeftUp | 1 | Only the left (or up) scroll button will be enabled.
cc2RightDown | 2 | Only the right (or down) scroll button will be enabled.

Remarks

When the Orientation of the FlatScrollBar changes from horizontal to vertical, the left scroll arrow becomes the up arrow, and the right scroll arrow becomes the down arrow.

The most common use of the Arrows property is to disable the appropriate scroll arrow when the maximum or minimum value of the control is reached.


AutoBuddy Property

Sets or returns a value that determines whether the UpDown control automatically uses a control as its buddy control, based on its tab order.

Syntax

object.AutoBuddy [= value]

The AutoBuddy property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A boolean expression that determines the buddy control, as described in Settings.

Settings

The settings for value are:

Setting | Description
True | The UpDown control uses the previous control in the tab order as its buddy control. If no controls with a previous tab index can be used as a buddy control, the UpDown control uses the first available control with a higher tab index as its buddy control.
False | (Default) The UpDown control uses the setting in the BuddyControl property as its buddy control.

Remarks

Setting the AutoBuddy property to True also sets the BuddyControl property. Setting AutoBuddy to False clears the BuddyControl property.


AutoPlay Property

Returns or sets a value which determines if the Animation control will begin to play an .avi file when the .avi file is loaded into the control.

Syntax

object.Autoplay [= boolean]

The AutoPlay property syntax has these parts:

Part | Description
object | An object expression that evaluates to an Animation control.
boolean | A Boolean expression specifying whether the Autoplay Property is enabled.

Settings

The settings for boolean are:

Setting | Description
True | The .avi file plays automatically in a continuous loop once it is loaded into the Animation control.
False | An .avi file, once loaded, does not play until the Play method is used.

Data Type

Integer (Boolean)

Remarks

An .avi file played using the Autoplay property will continue to repeat until Autoplay is set to False.


BackStyle Property (Animation Control)

Returns or sets a value that determines whether the Animation control draws the animation on a transparent background or on the background color specified in the animation clip. Read-only at run time.

Syntax

object.BackStyle [= value]

The BackStyle property syntax has these parts:

Part | Description
object | An object expression that evaluates to an Animation control.
value | A numeric expression specifying transparency, as described in Settings.

Settings

The settings for value are:

Setting | Description
0 | (Default) Transparent—background color of the control is visible.
1 | Opaque— the background color specified in the animation clip fills the control and obscures any color behind it.

Remarks

You can use the BackStyle property to run an animation that shows the background color of the Animation control rather than the background color of the animation itself.

Data Type

Integer (Boolean)


BuddyControl Property

Sets or returns the control used as the buddy control.

Syntax

object.BuddyControl [= value]

The BuddyControl property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A variant value that specifies the buddy control, as described below.

Remarks

The BuddyControl property can be set at design time or at run time. At run time, BuddyControl property in the Properties window. To set the BuddyControl property at run time, use the following code:

UpDown1.BuddyControl = Text1

You can also implicitly set the BuddyControl property by setting AutoBuddy to True. In this case, the BuddyControl is automatically set to the previous control in the tab order.

Setting the BuddyControl property to Nothing automatically sets the AutoBuddy setting to False.

Note Setting the BuddyControl property to a control that cannot be a buddy, such as the intrinsic label control, results in an error.


CalendarBackColor, CalendarForeColor Properties

Return or set a value that specifies the background or foreground color of the dropdown calendar portion of the control.

Syntax

object.CalendarBackColor [= color]

object.CalendarForeColor [= color]

The CalendarBackColor and CalendarForeColor property syntaxes have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the color to be used.

Settings

The settings for color are:

Setting | Description
RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

Remarks

The CalendarBackColor and CalendarForeColor properties can be used with the CalendarTitleBackColor, CalendarTitleForeColor, and CalendarTrailingForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


CalendarBackColor, CalendarTitleForeColor Properties Example

The example changes the appearance of the DateTimePicker control's calendar by resetting several color properties. To try the example, place a DateTimePicker and a CommandButton control on a form. Paste the code into the Declarations section of the code module. Start the project and click the DateTimePicker control to see the default colors. Click the CommandButton, and click the DateTimePicker control again to see the new colors.

Private Sub Command1_Click()
   With DTPicker1
      .CalendarBackColor = vbYellow
      .CalendarTitleBackColor = vbRed
      .CalendarTitleForeColor = vbWhite
      .CalendarTrailingForeColor = vbGreen
   End With
End Sub


CalendarTitleBackColor, CalendarTitleForeColor Properties

Return or set a value that specifies the background or foreground color of the title in the dropdown calendar portion of the control.

Syntax

object.CalendarTitleBackColor [= color]

object.CalendarTitleForeColor [= color]

The CalendarTitleBackColor and CalendarTitleForeColor property syntaxes have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the color to be used.

Settings

The settings for color are:

Setting | Description
RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

Remarks

The CalendarTitleBackColor and CalendarTitleForeColor properties can be used with the CalendarBackColor, CalendarForeColor, and CalendarTrailingForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


CalendarTrailingForeColor Property

Returns or sets a value that specifies the foreground color of trailing dates that are displayed in the dropdown calendar.

Syntax

object.CalendarTrailingForeColor [= color]

The CalendarTrailingForeColor property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the color of trailing dates — dates that belong to the previous or following months — as described in Settings.

Settings

The settings for color are:

Setting | Description
RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating environment substitutes the user's choices as specified in the Control Panel settings.

Remarks

Trailing dates are day numbers that are displayed which precede and follow day numbers of the currently selected month in the dropdown calendar. By default, trailing dates are displayed in vbWhite.

The CalendarTrailingForeColor property can be used with the CalendarBackColor, CalendarForeColor, CalendarTitleBackColor and CalendarTitleForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower 3 bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


Center Property

Determines whether the .avi file is centered within the Animation control. When set to True (the default), the .avi is displayed in the center of the control, based on the size of the image. When set to False, the .avi is positioned at 0,0 within the control.

Syntax

object.Center [= boolean]

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
boolean | Required. A Boolean expression specifying whether the AVI file is centered within the control.

Data Type

Integer (Boolean)

Remarks

If the Center property is set to True, and the .avi frame size is larger than the control, the edges of the .avi frames will not be shown as the file plays.


CheckBox Property

Returns or sets a value that determines if a check box is displayed to the left of the selected date.

Syntax

object.CheckBox [= boolean]

The CheckBox property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying whether or not a check box is displayed.

Settings

The settings for boolean are:

Setting | Description
True | A check box is displayed to the left of the selected date.
False | (Default) A check box is not displayed to the left of the selected date.

Remarks

The check box allows the user to determine whether or not to set the date using the control. When the check box is empty, no date is selected.


CustomFormat Property

Returns or sets a value that specifies the format used by the control when displaying date/time information.

Syntax

object.CustomFormat [= string]

The CustomFormat property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
string | A string expression specifying the format of the display.

Settings

The DateTimePicker control supports the following format characters:

String Fragment | Description
d | The one- or two-digit day.
dd | The two-digit day. Single digit day values are preceded by a zero.
ddd | The three-character weekday abbreviation.
dddd | The full weekday name.
h | The one- or two-digit hour in 12-hour format.
hh | The two-digit hour in 12-hour format. Single digit values are preceded by a zero.
H | The one- or two-digit hour in 24-hour format.
HH | The two-digit hour in 24-hour format. Single digit values are preceded by a zero.
m | The one- or two-digit minute.
mm | The two-digit minute. Single digit values are preceded by a zero.
M | The one- or two-digit month number.
MM | The two-digit month number. Single digit values are preceded by a zero.
MMM | The three-character month abbreviation.
MMMM | The full month name.
s | The one- or two- digit seconds.
ss | The two-digit seconds. Single digit values are proceeded by a zero.
t | The one-letter AM/PM abbreviation (that is, "AM" is displayed as "A").
tt | The two-letter AM/PM abbreviation (that is, "AM" is displayed as "AM").
X | A callback field. The control still uses the other valid format characters, and queries the owner to fill in the "X" portion. The owner must be ready to respond to events that request information about how to fill in these fields. Multiple 'X' characters can be used in series to signify unique callback fields.
y | The one-digit year (that is, 1997 would be displayed as "7").
yy | The last two digits of the year (that is, 1997 would be displayed as "97").
yyy | The full year (that is, 1997 would be displayed as "1997").

Remarks

The CustomFormat property acts as an input mask. To display a custom format, the Format property must be set to dtpCustom

You can add body text to the format string. For example, if you want the control to display the current date with the format "Today is:Friday July 25, 1997 Time: 8:34 AM", the CustomFormat string is "'Today is:' ddddMMMMdd, yyy ' Time: 'h:mtt". Body text must be enclosed in single quotation marks.

One of the custom format fields described above is a callback field. A callback field allows you to customize output by specifying certain parts of a format string as callback fields. To declare a callback field, you must include one or more 'X' characters (ASCII Code 88) anywhere in the body of the format string. Callback fields are displayed in left-to-right order.

When a new date is displayed in a format that includes one or more callback fields, the Format and FormatSize events are raised for each callback field. You can use the Format event to specify a custom response string, and the FormatSize event to determine the space needed to display the string. This behavior gives you complete control of how a callback field is displayed.

Each sequence of X's has a specific meaning. For example, X might mean "st/nd/rd/th" (for "1st" "2nd" "3rd" or "4th") and "XX" may mean "first" "second" "third" or "fourth". These fields do not format the user's text. They format the date into a displayable format.

For example, let's say you want to display the month in Spanish as well as English in a format like this:

July (Julio) 29

You would create a format string that looked like this:

MMMM XXXX d

When processing the Format and FormatSize events, you can check which callback field is being called by comparing the input format sting with "XXXX". If the field string matches, an output string "(Julio)" can be built and the length of the output string can be supplied.

The number of Xs is only used by an application to determine what text to supply for a callback field. When processing the FormatSize event, the size of the text can be programmatically calculated.

You can create unique callback fields by repeating the "X" character. Thus, the format string "XXddddMMMdd', 'yyyXXX" contains two callback fields. Callback fields are treated as valid fields, so the application must be prepared to handle Key events.


DayBold Property

Returns or sets a value that determines if a displayed day is bold.

Syntax

object.DayBold(date) [= boolean]

The DayBold property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
date | A date expression specifying a date found in the VisibleDays property.
boolean | A Boolean expression specifying whether or not the date is bolded.

Settings

The settings for boolean are:

Setting | Description
True | The date is displayed in bold.
False | (Default) The date is not displayed in bold.

Remarks

The DayBold property is an array that corresponds to the VisibleDays property. Each Boolean element indicates whether its corresponding date should be displayed in bold.

Only dates that are currently displayed are valid. Valid dates can be found by looking in the VisibleDays property.

As you move from month to month, the information in this property is not preserved.


DayBold Property Example

The following code sets the first and last displayed days to bold. To try the example, place a MonthView control on a form, paste the code into the Declarations section. Run the project and double-click the form.

Private Sub Form_DblClick()
   With MonthView1
      .DayBold(MonthView1.VisibleDays(1)) = True
      .DayBold(MonthView1.VisibleDays(42)) = True
   End With
End Sub


DayOfWeek Property

Returns or sets a value that specifies the current day of week.

Syntax

object.DayOfWeek [= number]

The DayOfWeek property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that specifies the day of the week, as shown in Settings below.

Settings

The settings for number are:

Constant | Value | Description
mvwSunday | 1 | (Default) Sunday
mvwMonday | 2 | Monday
mvwTuesday | 3 | Tuesday
mvwWednesday | 4 | Wednesday
mvwThursday | 5 | Thursday
mvwFriday | 6 | Friday
mvwSaturday | 7 | Saturday

Remarks

The DayOfWeek property can be set to any integer from 1 to 7.


Day Property

Returns or sets a value that specifies the current day number.

Syntax

object.Day [= number]

The Day property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that evaluates to an integer indicating the day number.

Remarks

The Day property can be set to any integer from 1 to 31.


Format Property (DateTimePicker Control)

Returns or sets a value that determines the format type used to display text on the control.

Syntax

object.Format [= integer]

The Format property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | A value specifying the format style used to display text in the control, as shown in Settings.

Settings

The settings for integer are:

Constant | Value | Description
dtpLongDate | 0 | Long Date Format (for example "Friday, Nov 14, 1972").
dtpShortDate | 1 | Short Date Format (for example "11/14/72").
dtpTime | 2 | Time Format (for example "5:31:47 PM").
dtpCustom | 3 | Custom format.

Remarks

Set the Format property to dtpCustom to use the CustomFormat property.


Hour Property

Returns or sets a value that specifies the current hour that is displayed.

Syntax

object.Hour [= value]

The Hour property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A numeric expression that specifies the current hour that is displayed.

Remarks

The Hour property can be any integer from 0 to 23.


Increment Property

Sets or returns a value that determines the amount by which the Value property changes when the UpDown control's buttons are clicked.

Syntax

object.Increment [= value ]

The Increment property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A long integer that determines the amount by which the Value property changes. The value cannot be a negative number. The default for value is 1.

Remarks

The Increment property determines the amount the Value property changes when you click the arrow buttons on the UpDown control. Clicking the up or right arrow, causes Value to approach the Max property by the amount specified by the Increment property. Clicking the down or left arrow, causes Value to approach the Min property by the amount specified by the Increment property.


MaxDate, MinDate Properties

Returns or sets the first and last date allowed by the calendar.

Syntax

object.MaxDate [= date]

object.MinDate [= date]

The MaxDate and MinDate property syntax’s have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
date | A date expression that evaluates to a valid date.

Remarks

The MaxDate property is used to set the upper boundary of the calendar.

The MinDate property is used to set the lower boundary of the calendar.


Max Property

Sets or returns the maximum value of the scroll range for the UpDown control.

Syntax

object.Max [= value]

The Max property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A long integer value that specifies the maximum value, as described below. The setting for value can be a negative number.

Remarks

Pressing the up or right arrow normally causes the UpDown control to increase the Value property, however, if the Max property is less than the Min property, the UpDown control operates in the reverse direction.

Pressing the up or right arrow always causes the Value property to approach the Max value. Pressing the down or left arrow always causes the Value property to approach the Min value.


MaxSelCount Property

Returns or sets the maximum number of contiguous days that can be selected at once.

Syntax

object.MaxSelCount [= number]

The MaxSelCount property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that evaluates to the number of days that can be selected at once.

Remarks

The MaxSelCount property is valid only when the MultiSelect property is to True. Additionally, the MaxSelCount property must be set to a value that is greater than the difference between the SelStart and SelEnd properties. For example, given a selection of 9/15 to 9/18, MonthView.SelEnd - MonthView.SelStart = 3. However, four days are actually selected; thus MaxSelCount must be set to 4.

The default of the property is one week (7 days).


Min Property

Sets or returns the minimum value of the scroll range for the UpDown control.

Syntax

object.Min [= value]

The Min property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A long integer value that specifies the minimum value, as described below. The setting for value can be a negative number.

Remarks

Pressing the down or left arrow normally causes the UpDown control to decrease the Value property. However, if the Min property is greater than the Max property, the UpDown control operates in the reverse direction.

Pressing the down or left arrow always causes the Value property to approach the Min value. Pressing the up or right arrow always causes the Value property to approach the Max value.


Minute Property

Returns or sets a value that specifies the current minute that is displayed.

Syntax

object.Minute [= value]

The Minute property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A numeric expression that specifies the current minute that is displayed.

Remarks

The Minute property can be any integer from 0 to 59.


MonthBackColor Property

Returns or sets a value that specifies the background color displayed within a month.

Syntax

object.MonthBackColor [= color]

The MonthBackColor property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the background color displayed within a month, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme. The settings for color are:

Setting | Description
Normal RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating system substitutes the user's choices as specified in the Control Panel settings.

Remarks

The MonthBackColor property can be used with the TitleBackColor, TitleForeColor and TrailingForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower three bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


MonthColumns, MonthRows Properties

Returns or sets a value that specifies the number of months to be displayed horizontally and vertically.

Syntax

object.MonthColumns [= number]

object.MonthRows [= number]

The MonthColumns and MonthRows property syntax’s have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression specifying the number of months.

Remarks

The MonthColumns and MonthRows properties give you the ability to display more than one month at a time.

The MonthColumns property allows you to specify the number of months that will be displayed horizontally. The MonthRows property allows you to specify the number of months that will be displayed vertically.

The control can display up to twelve months.


Month Property

Returns or sets a value that specifies the current month.

Syntax

object.Month [= number]

The Month property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A constant or numeric expression that evaluates to an integer indicating the month, as shown in Settings.

Settings

The settings for number are:

Constant | Value | Description
mvwJanuary | 1 | January
mvwFebruary | 2 | February
mvwMarch | 3 | March
mvwApril | 4 | April
mvwMay | 5 | May
mvwJune | 6 | June
mvwJuly | 7 | July
mvwAugust | 8 | August
mvwSeptember | 9 | September
mvwOctober | 10 | October
mvwNovember | 11 | November
mvwDecember | 12 | December

Remarks

The Month property can be set to any integer from 1 to 12.


MultiSelect Property (MonthView Control)

Returns or sets a value that determines if multiple dates can be selected at once.

Syntax

object.MultiSelect [= boolean]

The MultiSelect property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying the selection behavior exhibited by the control.

Settings

The settings for boolean are:

Setting | Description
True | (Default) The user is allowed to select multiple days.
False | The user is not allowed to select multiple days.

Remarks

By default, the control allows the user to select a range of dates. The default maximum range is one week (7 days). You can change the maximum selectable range by setting the MaxSelCount property. The Value property will be in this range, indicating which date has focus.


Orientation Property

Sets or returns the placement of the arrow buttons on the UpDown control. This property is read-only at run time.

Syntax

object.Orientation

The Orientation property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.

Settings

The settings for the Orientation property are:

Constant | Value | Description
cc2orientationVertical | 0 | (Default). The arrow buttons are positioned vertically.
cc2orientationHorizontal | 1 | The arrow buttons are positioned horizontally.

Remarks

At design time, this property can be set in the Properties window or through the control's property page.

When setting the Orientation property, the UpDown control automatically repositions itself next to its buddy control.


Orientation Property (FlatScrollBar Control)

Returns or sets a value that determines the orientation (horizontal or vertical) of the object.

Syntax

object.Orientation [= integer]

The Orientation property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | A numeric expression that determines the orientation of the control, as shown in Settings.

Settings

The settings for integer are:

Constant | Value | Description
cc2OrientationHorizontal | 0 | (Default) The control is oriented horizontally.
cc2OrientationVertical | 1 | The control is oriented vertically.


ScrollRate Property

Returns or sets a value that specifies the number of months that are scrolled when the user clicks one of the scroll buttons.

Syntax

object.ScrollRate [= number]

The ScrollRate property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that specifies the number of months that are scrolled at once.

Remarks

The ScrollRate property allows the user to scroll more than one month at a time.


Second Property

Sets or returns the integer representing the currently displayed second.

Syntax

object.Second [= integer]

The Second property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | An numeric expression between 0 and 59 that represents the seconds.


SelEnd, SelStart Properties (MonthView Control)

Returns or sets the upper and lower bounds of the date range that is selected.

Syntax

object.SelEnd [= date]

object.SelStart [= date]

The SelEnd and SelStart property syntax’s have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
date | A date expression that evaluates to a valid date.

Remarks

The SelStart property defines the lower bound of the date range that is selected. The SelEnd property defines the upper bound of the date range that is selected.

The range of selected dates can span multiple months. It can include dates that are not currently displayed.

In order for multiple date selection to work properly, the MaxSelCount property must be set to a value that is greater than the difference between the SelStart and SelEnd properties.

The SelStart and SelEnd settings are only valid if the MultiSelect property is set to TRUE.


SelEnd, SelStart Properties Example

Assuming the MaxSelCount property is set to 7, the following code selects the days from November 8, 1998 to November 14, 1998:

With MonthView1
   .MultiSelect = True
   .Value = CDate("11/8/98")
   .SelStart = CDate("11/8/98")
   .SelEnd = CDate("11/14/98")
End With

Setting the Value property inherently sets the SelStart and SelEnd properties to the same date. Without setting the Value property first, setting the SelStart property would have selected all days between the currently selected date and the SelStart date.


ShowToday Property

Returns or sets a value that determines if the current date is displayed at the bottom of the control.

Syntax

object.ShowToday [= boolean]

The ShowToday property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying the status of the current date indicators.

Settings

The settings for boolean are:

Setting | Description
True | (Default) The current date is displayed.
False | The current date is not displayed.


ShowWeekNumbers Property

Returns or sets a value that determines if the week numbers are displayed next to each week.

Syntax

object.ShowWeekNumbers [= boolean]

The ShowWeekNumbers property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying the status of the current date indicators.

Settings

The settings for boolean are:

Setting | Description
True | Week numbers are displayed.
False | (Default) Week numbers are not displayed.

Remarks

Week numbers are displayed to the left of the week, and start from the first week of the calendar year.


StartOfWeek Property

Returns or sets a value that specifies the starting day of the week.

Syntax

object.StartOfWeek [= integer]

The StartOfWeek property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | A numeric expression specifying the starting day of the week, as shown in Settings.

Settings

The settings for integer are:

Constant | Value | Description
mvwSunday | 1 | (Default) Sunday
mvwMonday | 2 | Monday
mvwTuesDay | 3 | Tuesday
mvwWednesday | 4 | Wednesday
mvwThursday | 5 | Thursday
mvwFriday | 6 | Friday
mvwSaturday | 7 | Saturday

Remarks

The StartOfWeek property allows you to specify the day that will appear in the far left side of the calendar. This can be helpful when designing applications for multiple countries.


SyncBuddy Property

Sets or returns a value that determines whether the UpDown control synchronizes the Value property with a property in the buddy control.

Syntax

object.SyncBuddy [= value]

The SyncBuddy property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A boolean expression that determines whether the buddy control synchronizes with the UpDown control, as described in Settings.

Settings

The settings for value are:

Setting | Description
True | The UpDown control synchronizes the Value property with a property of the buddy control, specified by the BuddyProperty property. If no property is specified in the BuddyProperty property, then the default property for the buddy control is used.
False | (Default) The UpDown control doesn't synchronize the Value property with a property in the buddy control.

Remarks

Use the SyncBuddy property to automatically synchronize a property of the buddy control with the Value property of the UpDown control. For example, you can synchronize the Value property of the UpDown control with the Text property of a TextBox control. Whenever the Value property changes, it would update the Text property in the TextBox control and vice versa. You can also synchronize the Value property of the UpDown control with other properties of a control such as the Top, Left, BackColor, ForeColor, and others.

To see a list of the available properties you can synchronize the Value property with (after setting the BuddyControl property), select the BuddyProperty property in the properties window or from the Properties Page.


TitleBackColor, TitleForeColor Properties

Return or set values that specify the background and foreground colors of the title area of the control.

Syntax

object.TitleBackColor [= color]

object.TitleForeColor [= color]

The TitleBackColor and TitleForeColor properties' syntax have these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the color to be used.

Settings

Visual Basic uses the Microsoft Windows operating system red-green-blue (RGB) color scheme. The settings for color are:

Setting | Description
Normal RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating system substitutes the user's choices as specified in the Control Panel settings.

Remarks

The TitleBackColor and TitleForeColor properties can be used with the MonthBackColor and TrailingForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower three bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


TitleBackColor, TitleForeColor, TrailingForeColor Properties Example

The example changes the appearance of a MonthView control by resetting the TitleBackColor, TitleForeColor, and TrailingForeColor properties. To try the example, place a MonthView control on a form, and paste the code into the Declarations section of the code module. Run the project, and double-click the form to see the calendar change.

Private Sub Form_DblClick()
   With MonthView1
      .TitleBackColor = vbBlue
      .TitleForeColor = vbWhite
      .TrailingForeColor = vbRed
   End With
End Sub


TrailingForeColor Property

Returns or sets a value that specifies the foreground color of trailing dates that are currently displayed.

Syntax

object.TrailingForeColor [= color]

The TrailingForeColor property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
color | A value or constant that determines the color of trailing dates, as described in Settings.

Settings

Visual Basic uses the Microsoft Windows operating environment red-green-blue (RGB) color scheme. The settings for color are:

Setting | Description
Normal RGB colors | Colors specified by using the Color palette or by using the RGB or QBColor functions in code.
System default colors | Colors specified by system color constants listed in the Visual Basic (VBRUN) object library in the Object Browser. The Windows operating system substitutes the user's choices as specified in the Control Panel settings.

Remarks

Trailing dates are day numbers that are displayed which precede and follow day numbers of the currently selected month. By default, trailing dates are displayed in vbWhite.

The TrailingForeColor property can be used with the MonthBackColor, TitleBackColor and TitleForeColor properties to customize the colors of the control.

The valid range for a normal RGB color is 0 to 16,777,215 (&HFFFFFF). The high byte of a number in this range equals 0; the lower three bytes, from least to most significant byte, determine the amount of red, green, and blue, respectively. The red, green, and blue components are each represented by a number between 0 and 255 (&HFF). If the high byte isn't 0, Visual Basic uses the system colors, as defined in the user's Control Panel settings and by constants listed in the Visual Basic (VBRUN) object library in the Object Browser.


UpDown Property

Returns or sets a value that determines if an up-down control appears to the right of the DateTimePicker control.

Syntax

object.UpDown [= boolean]

The UpDown property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying whether or not an up-down control appears to the right of the DateTimePicker control.

Settings

The settings for boolean are:

Setting | Description
True | An up-down control appears.
False | (Default) An up-down control does not appear.

Remarks

The up-down buttons can be used instead of the drop-down calendar to select a date.


Value Property (MonthView, DatePicker Controls)

Returns or sets the date currently displayed.

Syntax

object.Value [= date]

The Value property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
date | A date expression specifying a date displayed by the control.

Remarks

The Value property is the default property of the control.


Value Property (UpDown Control)

Sets or returns the current position of the scroll value.

Syntax

object.Value [= long]

The Value property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
long | A long integer that specifies the current value, as described below.

Remarks

The Value property specifies the current value within the range of the Min and Max properties. This property is incremented or decremented when the arrow buttons are clicked. The settings of the Min and Max properties determine whether the value is incremented or decremented when the arrow buttons are clicked.

If the SyncBuddy property is set to True, the BuddyProperty property is synchronized when there is a change in the Value property or when the BuddyProperty property value is changed.


VisibleDays Property

Returns an array containing the dates that are currently visible.

Syntax

object.VisibleDays(index)

The VisibleDays property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
index | An integer which specifies a displayed date on the calendar.

Remarks

Index can be any value from 1 to 42. A value of 1 indicates the first date that is currently displayed.

Only dates that are currently displayed can be found in the VisibleDays property. In addition, the number of visible days can changes depending on the settings of the MonthColumns and MonthRows properties.

As you move from month to month, the information in this property is not preserved.


VisibleDays Property Example

The following code prints the dates of all days displayed on the calendar. To try the example, place a MonthView control on a form and paste the code into the Declarations section. Run the project and double-click the form.

Private Sub Form_DblClick()
   Dim i As Integer
   For i = 1 To 42
      Debug.Print MonthView1.VisibleDays(i)
   Next i
End Sub


Week Property

Returns or sets a value that specifies the current week number.

Syntax

object.Week [= number]

The Week property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that evaluates to an integer indicating the week number.

Remarks

The Week property can be set to any integer from 1 to 52.


Wrap Property

Sets or returns a value that determines whether the control's Value property wraps around to the beginning or end once it reaches the Max or Min value.

Syntax

object.Wrap [= value]

The Wrap property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
value | A boolean expression that determines whether the UpDown control wraps its Value property, as described in Settings.

Settings

The settings for value are:

Setting | Description
True | The UpDown control wraps the Value property to the beginning or end when the user moves past the Max or Min properties using the arrow buttons.
False | (Default) The UpDown control doesn't wrap the Value property.

Remarks

When Wrap is True, the Value property wraps according to the value of the Min, Max, and Increment properties.

When the Value property wraps, its first jump is to the Min value. For example, if Min is 20, Max is 70, Increment is 10, Value is 70, and the user clicks the up or right arrow button, the Value property wraps to 20.


Wrap Property Example

This example uses the Wrap property with the UpDown control to create a wrapping spinner control with values that range from 10 to 70 and an increment of 10. To try this example, place a TextBox control and an UpDown control on your form and add the following code:

Private Sub Form_Load()
   UpDown1.BuddyControl = Text1
   With UpDown1
      .Min = 10
      .Max = 70
      .Increment = 10
      .Wrap = True
      .SyncBuddy = True
   End With

   ' So the TextBox reflects the starting value
   Text1.Text = UpDown1.Value
End Sub


Year Property

Returns or sets a value that specifies a calendar year.

Syntax

object.Year [= number]

The Year property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression that evaluates to an integer indicating the year.

Remarks

The Year property can be set to any integer from 1601 to 9999.


Year Property (ActiveX Controls)

Returns or sets the currently displayed year.

Syntax

object.Year [= number]

The Second property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
number | A numeric expression between the MinDate and MaxDate property values.