// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
public void WireDropDownOpeningEvent()
{
GcDateTime date1 = new GcDateTime();
date1.DropDownOpening += new EventHandler<DropDownOpeningEventArgs>(OnDateDropDownOpening);
}
private void OnDateDropDownOpening(object sender, DropDownOpeningEventArgs e)
{
GcDateTime date1 = sender as GcDateTime;
if (date1 != null)
{
if (date1.InputStatus != InputStatus.Empty && date1.Value == null)
{
// Doesn't show the drop-down window when the value of the GcDateTime control is null.
e.Cancel = true;
// Doesn't synchronize data from drop-down window to the GcDateTime control.
e.SyncData = false;
}
}
}
' Please use the following namespace
' Imports System.Windows.Forms;
' Imports GrapeCity.Win.Editors;
Public Sub WireDropDownOpeningEvent()
Dim GcDateTime1 As New GcDateTime()
AddHandler GcDateTime1.DropDownOpening, AddressOf OnDateDropDownOpening
End Sub
Private Sub OnDateDropDownOpening(ByVal sender As Object, ByVal e As DropDownOpeningEventArgs)
Dim GcDateTime1 As GcDateTime = TryCast(sender, GcDateTime)
If (Not GcDateTime1 Is Nothing) Then
If GcDateTime1.InputStatus <> InputStatus.Empty AndAlso GcDateTime1.Value = Nothing Then
' Doesn't show the drop-down window when the value of the GcDateTime control is Nothing.
e.Cancel = True
' Doesn't synchronize data from drop-down window to the GcDateTime control.
e.SyncData = False
End If
End If
End Sub