MonthEnd.gif (3102 bytes)

Properties and Events

Properties and Events

The control exposes these read-only properties to the programmer

Property Example Notes Type
FromDateAsDate 01/01/01 The beginning date of the first month that the user has selected Date. Expose this property and add or subtract to it with date math, if you want, like Months1.FromDateAsDate -1
ToDateAsDate 12/31/01 The end date of the last month that the user has selected Date. Same as above. Also like above, use format(ToMonthAsDate,"mm/dd/yy") or some other format to turn it into a string
FromDateAsColumn 1 or 12 or 24 The number of the first month the user has selected. If the data starts on Jan 1,2000, and the user selects June, 2000, this value is 6 Integer. See Methods for getting start and end values
ToDateAsColumn 1 or 12 or 24 The number of the end month the user has selected. If there are 26 months then on form load, this value is 26. If the user drops down and selects last year, this will end up as 14 Integer. See Methods for getting start and end values

These properties are SET at run-time or on refresh of the control:

Property Example Remarks
AppStartDate 01/01/01 or any calculation Set this to tell the program at which date to begin calculating months
AppEndDate 12/31/01 or any calculation Set this to tell the program where to end calculating months.
AppNumMonths 24 Used in special circumstances, when your application has a specific number of months, like in budgeting or forecasting
CalendarType 1, 2 or 3 Supports three different calendar types

Methods and Events

These methods and events are available to the programmer:

Method/Event Example Explanation
Click Gives you immediate access to the properties Use two label controls to give your user immediate feedback on their selection. Caption 1 is Months1.FromDateAsDate, the other caption is Months1.ToDate AsDate
MonthBegin(array value) 01/01/01 The starting date of the months you have selected and all of those in between
MonthEnd(array value) 12/31/01 The End date of the months you have selected and all of those in between
Refresh Months1.Refresh If you change any of the read-only properties, like AppStartDate,AppEndDate,AppNumMonths or Calendar Type, then execute this. There are no parameters, just one line.

MonthBegin(number) and MonthEnd(number) give you the beginning and ending values of the all the months between FromDateAsColumn and ToDateAsColumn. Use a loop to retrieve these values, as in the following example:

For I=Months1.FromDateAsColumn to Months1.ToDateAsColumn

Debug.Print Months1.MonthBegin(i),Months1.MonthEnd(i)

Next i

Just a note:

If your data starts on Jan1, 2001 and you select June of 2001, then Months1.FromDateAsColumn is 6, and "I" starts at 6.

If you are using Calendar types two or three, the program works exactly the same way, giving you column values and the beginning and ending dates of each month.

Return to MiniSolve