I would like to differentiate between changing the text programmatically (for example in a button click handler event) and user input (typing, cutting and pasting text). <
Similar to JHunz's answer, just add a boolean member variable to your control:
bool programmaticChange = false;
When you are making programmatic changes do this:
programmaticChange = true;
// insert changes to the control text here
programmaticChange = false;
In your event handlers, you just need to inspect the value of programmaticChange
to determine if its a programmatic change or not.
Fairly obvious and not very elegant but its also workable and simple.