Calendar in Windows Forms proj (ProjIO)

29 Apr 20211 minute to read

Calendar class is used to create calendars and add them to the project. Using the Calendar class, one can create calendar exceptions (holidays, different working times and working days), define working days, working times, and so on. It can also add a standard calendar to the project. Calendar class contains properties that can be used to retrieve information of all calendars present in a project.

Properties, Methods, and Events Tables for Task

Constructors

Calendar Constructors

Name Description
Calendar.Calendar() Initializes a new instance of Calendar class.
Calendar.Calendar(string calendarName) Initializes a new instance of Calendar class with the calendar name.

Properties

Calendar Properties

Property Description
UID Gets or sets the unique identifier of the calendar.
Name Gets or sets the name of the calendar.
IsBaseCalendar True if the calendar is a base calendar.
IsBaselineCalendar True if the calendar is a baseline calendar.
BasecalendarUID Gets or sets the unique identifier of the base calendar on which this calendar depends. Only applicable if the calendar is not a base calendar.
WeekDays Gets or sets the collection of weekdays that defines this calendar.
Exceptions Gets or sets the collection of exceptions that is associated with the calendar.
WorkWeeks Gets or sets the collection of effective work weeks associated with the calendar.

Methods

Calendar Methods

Method Description
Equals Returns a value indicating whether this instance is equal to a specified object
GetHashCode Serves as a hash function for Calendar type
GetType Gets the type of the current instance
ToString Returns a string that represents the current object
Calendar.StandardCalendar() Creates a standard calendar
Calendar.StandardCalendar(string calendarName) Creates a standard calendar

Creating a Standard Calendar

The static method StandardCalendar is used to create a standard calendar and add it to the project.

This method contains two overloads namely:

  • StandardCalendar() – Creates a standard calendar
  • StandardCalendar(string calendarName) – Creates a standard calendar by passing the calendar name

The following code snippet shows how to make use of this method:

  • C#
  • // Creating a standard calendar
    
    Calendar calendar = Calendar.StandardCalendar();
    
    
    
    // Creating a standard calendar by passing the calendar name
    
    Calendar calendar1 = Calendar.StandardCalendar("Standard");
  • VBNET
  • ' Creating a standard calendar
    
    Dim calendar As Calendar = Calendar.StandardCalendar()
    
    
    
    ' Creating a standard calendar by passing the calendar name
    
    Dim calendar1 As Calendar = Calendar.StandardCalendar("Standard")