Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Databinding and tabsheets

Status
Not open for further replies.

aprobe

Programmer
Dec 4, 2003
36
NZ
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top