// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
public void WireTextChangingEvent()
{
// Create an instance of a GcTextBox control.
GcTextBox gcTextBox1 = new GcTextBox();
// Wire the TextChanging event.
gcTextBox1.TextChanging += new TextChangingEventHandler(OnTextBoxTextChanging);
}
private void OnTextBoxTextChanging(object sender, TextChangingEventArgs e)
{
// If the text change result will be string.Empty or null, cancel the text change process.
if (string.IsNullOrEmpty(e.Result))
{
e.Cancel = true;
}
}
' Please use the following namespace
' Imports System.Windows.Forms;
' Imports GrapeCity.Win.Editors;
Public Sub WireTextChangingEvent()
' Create an instance of a GcTextBox control.
Dim gcTextBox1 As New GcTextBox()
' Wire the TextChanging event.
AddHandler gcTextBox1.TextChanging, AddressOf OnTextBoxTextChanging
End Sub
Private Sub OnTextBoxTextChanging(ByVal sender As Object, ByVal e As TextChangingEventArgs)
' If the text change result will be string.Empty or null, cancel the text change process.
If String.IsNullOrEmpty(e.Result) Then
e.Cancel = True
End If
End Sub