'Declaration Public Function GetDay( _ ByVal date As Date, _ ByVal createIfNull As Boolean _ ) As Day
public Day GetDay( DateTime date, bool createIfNull )
Day objects are only created as they are needed and wherever possible, are not created directly by the controls when interacting with the UltraCalendarInfo. The first time that a Day is requested, the object will be created (assuming createIfNull is true) and the InitializeDay event will be fired.
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.IO Imports System.Globalization Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click '-------------------------------------------------------------------------------- ' GetDay ' ' This example uses the GetDay method to get get a Day object for the current date ' if the current day has not yet been initialized, it prompts the user before creating it. '-------------------------------------------------------------------------------- ' Get a day object for the current date, but don't create it ' yet if the day has not yet been initialized. This is accomplished ' by setting the 'createIfNull' parameter to false. Dim day As Infragistics.Win.UltraWinSchedule.Day day = Me.ultraCalendarInfo1.GetDay(DateTime.Today, False) ' If a Day object for the current date has not yet been created, ' prompt the user to see if they want to create it now. If (day Is Nothing) Then Dim result As DialogResult = MessageBox.Show("A Day object for the current date has not yet been created. Would you like to create it now?", "GetDay", MessageBoxButtons.YesNo) If (result = DialogResult.No) Then Return ' This time, specify true for 'createIfNull', so the day is guaranteed ' to be created day = Me.ultraCalendarInfo1.GetDay(DateTime.Today, True) End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.IO; using System.Globalization; private void button1_Click(object sender, System.EventArgs e) { // Get a day object for the current date, but don't create it // yet if the day has not yet been initialized. This is accomplished // by setting the 'createIfNull' parameter to false. Infragistics.Win.UltraWinSchedule.Day day = null; day = this.ultraCalendarInfo1.GetDay( DateTime.Today, false ); // If a Day object for the current date has not yet been created, // prompt the user to see if they want to create it now. if ( day == null ) { DialogResult result = MessageBox.Show( "A Day object for the current date has not yet been created. Would you like to create it now?", "GetDay", MessageBoxButtons.YesNo ); if ( result == DialogResult.No ) return; // This time, specify true for 'createIfNull', so the day is guaranteed // to be created day = this.ultraCalendarInfo1.GetDay( DateTime.Today, true ); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2