Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.CalendarCombo Private Sub AllowNullValues(ByVal allow As Boolean) If (allow) Then ' Set AllowNull to true Me.ultraCalendarCombo1.AllowNull = True ' Set the NullDateLabel to "(no date selected)", which the control ' will display when the Value property is set to null Me.ultraCalendarCombo1.NullDateLabel = "(no date selected)" Else ' If the Value property is null, we can't set AllowNull to false, ' or an exception will be thrown. When that is the case, change ' the Value to the current date. If Me.ultraCalendarCombo1.Value Is Nothing Or Me.ultraCalendarCombo1.Value Is DBNull.Value Then Me.ultraCalendarCombo1.Value = DateTime.Today ' Now set the AllowNull property Me.ultraCalendarCombo1.AllowNull = False End If End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.CalendarCombo; private void AllowNullValues( bool allow ) { if ( allow ) { // Set AllowNull to true this.ultraCalendarCombo1.AllowNull = true; // Set the NullDateLabel to "(no date selected)", which the control // will display when the Value property is set to null this.ultraCalendarCombo1.NullDateLabel = "(no date selected)"; } else { // If the Value property is null, we can't set AllowNull to false, // or an exception will be thrown. When that is the case, change // the Value to the current date. if ( this.ultraCalendarCombo1.Value == null || this.ultraCalendarCombo1.Value == DBNull.Value ) this.ultraCalendarCombo1.Value = DateTime.Today; // Now set the AllowNull property this.ultraCalendarCombo1.AllowNull = false; } }
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