Sunday, February 1, 2015

Text Changed Event conflicting with Selected Index Changed Event

Your problem is that you are using the textboxes to perform two separate functions, displaying the current selection and editing. This sort of approach is asking for just the kind of trouble that you are experiencing. Experience tells me that if you persevere for long enough, you will eventually get it to work, but the result will be a confusing tangle of setting and unsetting flags based on whether the textboxes have gained or lost the focus (and hence the text change is due to the user typing in the box or not), and you won't have any way for the user to cancel their changes if they make a mistake.


I suggest adding an Edit button which explicitly sets the textboxes into edit mode, and Apply and Cancel buttons to confirm or discard the changes. Or possibly even better, write a new form just for editing that is invoked when the Edit button is pressed.

No comments:

Post a Comment