J
JackA
Guest
I have a form that is composed of a ListBox, several controls, and a dataGridView. The ListBox displays a list of names and the DataGridView displays a list of schedules associated with that person. The user of the application can then click on the DGV and the row is loaded into the rest of the form allowing them to edit it (or create a new schedule). Here is the problem Im having:
When the user changes a value on the form I want to set a "dirty" bit so I know they changed something and can a) turn on the "SAVE" button, and b) prompt them for a message when they try and navigate away from the record or current tab. HOWEVER, all the events I try and respond to also fire when the grid and controls are databound. I only want to respond to USER changes, NOT system changes. How do I filter this?
Here is the method I currently have on the BindingComplete event for the BindingSource most of my controls are bound to:
Code Snippet
private void tab2_scheduleBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e)
{
if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate)
{
if (e.BindingCompleteState == BindingCompleteState.Success && e.Binding.Control.ContainsFocus)
{
;
}
}
}
In the above sample ContainsFocus doesnt work since by the time this event has fired the CheckBox the user clicked no longer has focus.
Thoughts on how I go about setting a "dirty" or "changed" bit when the user makes changes to my data, BUT ignoring the system changes to the data?
Continue reading...
When the user changes a value on the form I want to set a "dirty" bit so I know they changed something and can a) turn on the "SAVE" button, and b) prompt them for a message when they try and navigate away from the record or current tab. HOWEVER, all the events I try and respond to also fire when the grid and controls are databound. I only want to respond to USER changes, NOT system changes. How do I filter this?
Here is the method I currently have on the BindingComplete event for the BindingSource most of my controls are bound to:
Code Snippet
private void tab2_scheduleBindingSource_BindingComplete(object sender, BindingCompleteEventArgs e)
{
if (e.BindingCompleteContext == BindingCompleteContext.DataSourceUpdate)
{
if (e.BindingCompleteState == BindingCompleteState.Success && e.Binding.Control.ContainsFocus)
{
;
}
}
}
In the above sample ContainsFocus doesnt work since by the time this event has fired the CheckBox the user clicked no longer has focus.
Thoughts on how I go about setting a "dirty" or "changed" bit when the user makes changes to my data, BUT ignoring the system changes to the data?
Continue reading...