TextChanging Event of TextBox

  • Thread starter Thread starter Joe Su
  • Start date Start date
J

Joe Su

Is there a way to make a control based on Windows.Forms.TextBox, and it
has a TextChanging event fired before Text property value change.
otherwise there are two properties in the event args
1. ChangedText : it is the text after changed
2. Cancel : if user set Cancel to True then cancel the change of text,
and do not fire the TextChanged event

Expecting...
 
Hi Joe,

If you need to do some input validation, you might be better off handling
the KeyUp, KeyDown and KeyPressed events - that's what Microsoft recommends
in its 70-316 exam preparation book, if I am not mistaken.
 
Thank you Dmytro Lapshyn

in fact I really want to do some input validation, but user can change
the Text property by mouse or on the other way,
I am afraid i can not intercept all of the case.

Say sorry to my poor english, i am not birth in a english speaking
country
 
Joe,

English is not my mother tongue either :-)

Unfortunately, this kind of "TextChanging" notification is not supported on
the operating system level, so you might end up pre-handling every possible
user event, or resorting to a third-party edit control having built-in
validation capabilities (like Microsoft MaskEdit).
 
Back
Top