If items such as textboxes or labels are placed on tabsheets on a windows form and you programatically change a value on a tabsheet which is not visible (or not previously been shown), when you save the record the change is never updated.
If the user selects the tabsheet prior to saving the record the field updated programatically is correct. However, you cannot expect the user to go through all the tabsheets prior to saving a record when they may only require to change one field.
If in the program you perform a tabPage.Show() command the details are also updated correctly, but this is unacceptable as the screen redrawing as it flicks through all the tabsheets looks a complete mess.
I have tried setting the advanced binding 'Data Source Update Mode' to OnPropertyChanged, but this has no effect.
I have also tried calling the method Binding.WriteValue which is supposed to read the current value from the control property and write it to the data source. But this has no effect either.
The following is a typical example of my attempts to get this to work.
txtChangedDate.Text = DateTime.Now.ToString();
foreach (Binding binding in edtChangedDate.DataBindings)
{
if (binding.PropertyName == "Text")
{
binding.WriteValue();
}
}
Does anyone have any idea how to force an update to a bound field without first showing the details.
Thanks
If the user selects the tabsheet prior to saving the record the field updated programatically is correct. However, you cannot expect the user to go through all the tabsheets prior to saving a record when they may only require to change one field.
If in the program you perform a tabPage.Show() command the details are also updated correctly, but this is unacceptable as the screen redrawing as it flicks through all the tabsheets looks a complete mess.
I have tried setting the advanced binding 'Data Source Update Mode' to OnPropertyChanged, but this has no effect.
I have also tried calling the method Binding.WriteValue which is supposed to read the current value from the control property and write it to the data source. But this has no effect either.
The following is a typical example of my attempts to get this to work.
txtChangedDate.Text = DateTime.Now.ToString();
foreach (Binding binding in edtChangedDate.DataBindings)
{
if (binding.PropertyName == "Text")
{
binding.WriteValue();
}
}
Does anyone have any idea how to force an update to a bound field without first showing the details.
Thanks