// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
public void WireDropDownOpening()
{
// Create an instance of a GcTextBox control.
GcTextBox gcTextBox1 = new GcTextBox();
// Wire the DropDownOpening and DropDownClosing events.
gcTextBox1.DropDownOpening += new EventHandler<DropDownOpeningEventArgs>(OnGcTextBox1DropDownOpening);
gcTextBox1.DropDownClosing += new EventHandler<DropDownClosingEventArgs>(OnGcTextBox1DropDownClosing);
}
private void OnGcTextBox1DropDownClosing(object sender, DropDownClosingEventArgs e)
{
if ((sender as GcTextBox).DropDownEditor.Text.Length > 100)
{
// Set e.SyncData property to false. So that the gcTextBox1 will not accept DropDownEditor's text.
e.SyncData = false;
}
}
private void OnGcTextBox1DropDownOpening(object sender, DropDownOpeningEventArgs e)
{
if ((sender as GcTextBox).Text.Length == 0)
{
// Set e.Cancel property to true. So that the DropDownEditor Window will not shown.
e.Cancel = true;
}
}
' Please use the following namespace
' Imports System.Drawing
' Imports System.Windows.Forms
' Imports GrapeCity.Win.Editors
Public Sub WireDropDownOpening()
' Create an instance of a GcTextBox control.
Dim gcTextBox1 As New GcTextBox()
' Wire the DropDownOpening and DropDownClosing events.
AddHandler gcTextBox1.DropDownOpening, AddressOf OnGcTextBox1DropDownOpening
AddHandler gcTextBox1.DropDownClosing, AddressOf OnGcTextBox1DropDownClosing
End Sub
Private Sub OnGcTextBox1DropDownClosing(ByVal sender As Object, ByVal e As DropDownClosingEventArgs)
If TryCast(sender, GcTextBox).DropDownEditor.Text.Length > 100 Then
' Set e.SyncData property to false. So that the gcTextBox1 will not accept DropDownEditor's text.
e.SyncData = False
End If
End Sub
Private Sub OnGcTextBox1DropDownOpening(ByVal sender As Object, ByVal e As DropDownOpeningEventArgs)
If TryCast(sender, GcTextBox).Text.Length = 0 Then
' Set e.Cancel property to true. So that the DropDownEditor Window will not shown.
e.Cancel = True
End If
End Sub