Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Set focus to the UltraDateTimeEditor
Me.UltraDateTimeEditor1.Focus()
' Set the AlwaysInEditMode property to false
Me.UltraDateTimeEditor1.AlwaysInEditMode = False
' Don't allow null values
Me.UltraDateTimeEditor1.Nullable = False
' Set the DateTime property to the current date
Me.UltraDateTimeEditor1.DateTime = DateTime.Today
' Use the text selection-related properties to clear the edit portion
Me.UltraDateTimeEditor1.SelectionStart = 0
Me.UltraDateTimeEditor1.SelectionLength = Me.UltraDateTimeEditor1.Value.ToString().Length
Me.UltraDateTimeEditor1.SelectedText = ""
End Sub
Private Sub UltraDateTimeEditor1_BeforeDropDown(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles UltraDateTimeEditor1.BeforeDropDown
If (Not Me.UltraDateTimeEditor1.IsDateValid) Then
e.Cancel = True
MessageBox.Show("Please type a valid date.", "BeforeDropDown", MessageBoxButtons.OK)
End If
End Sub