"Jeff Williams" <je************ *******@hardsof t.com.auwrote in message
news:13******** *****@corp.supe rnews.com...
>I have a windows form which contains various controls like textboxes,
comboboxes, checkboxes etc.
When the user clicks the ok button I would like to determine if the data
has changed in one or more of this controls.
What is the easiest way to find this information out.
If data is changed I will update the record. If no I will just ignore the
update.
I've done this in the past as follows:
When loading the form, I loop recursively through the Controls collection
finding all the controls that are of one of the types whose changes I want
to monitor. For each of these controls, I connect its Change event to a
common method in the form (one for each kind of change event, since the
EventArgs is not the same for all the kinds of control). This method sets a
flag when it detects a chage, and this flag is what I monitor for changes
when closing the form.