TextChanged Event

hog

Senior Contributor
Joined
Mar 17, 2003
Messages
984
Location
UK
I have code in a textboxes textchanged event which obviously fires when the user changes the text in the textbox.

Question is if I change the textboxes text from code elsewhere during runtime, why doesn't the textchanged event fire?

Is there a way to force it to fire?
 
Mmm correct me if I'm wrong but is it ok to call a textbox textchanged event manually?

If so I have just sorted it:):)
 
You can manually call any event handler as they're just functions that happen to get called by the event handler (through a delegate). The "special" work is done by the event, not the function that gets called.

Many people would rather move the code out from the TextChanged event into a function, say UpdateFirstName (if the textbox is txtFirstName for instance). Then call UpdateFirstName() from the event handler (TextChanged event) and from wherever else you're changing the textbox's value manually.

-Nerseus
 
Back
Top