Hey All,
I can't see to find a nice solution to this. I have a textbox, and a button. When the textbox text is set by the user, I want the button to enable. When the text is set through code (ie. textbox.Text = "Hi"), I don't want it to fire the event. Is there an event that I can use that will listen only to user interaction and not programmatic changes?
Well, perhaps every time you modify the text in the code, you can set the button's enabled property to false.
That way, the TextChanged (or whatever, the event that fires when the text is changed) sets the button enabled, then the code resets it. But when the user changes the text, the button isn't reset to disabled.
Well, perhaps every time you modify the text in the code, you can set the button's enabled property to false.
That way, the TextChanged (or whatever, the event that fires when the text is changed) sets the button enabled, then the code resets it. But when the user changes the text, the button isn't reset to disabled.
Right, it would just be nicer if we didn't have to worry and do that sort of dependency. Just curious if there was another approach that only listened to user input
Right, it would just be nicer if we didn't have to worry and do that sort of dependency. Just curious if there was another approach that only listened to user input
We are also running into issues that there is no gurantee that:
tb.text ="hi";
button.Enabled = false;
No guarantees that button.Enabled gets run after the event, which means you run into cases where the button is not set.