Hi
I often have a form with a number of databound textboxes. The problem is
that when the user edits a textbox and then closes the form without first
leaving the textbox, the databinding is not commited and the property not
set in the bound object. What I do now is to run EndCurrentEdit() on all
bound controls when the form closes to make sure all changes are saved. But
it look really ugly. How is this supposed to be accomplished the proper way?
/Andreas
Gav - 25 Aug 2005 00:26 GMT
How about this... a little cleaner:
foreach(Control ctl in this.Controls)
{
if (ctl.GetType()== typeof(TextBox))
{
if (((TextBox)ctl).Focused)
{
//You now have the control being edited so call EndCurrentEdit
on this control
}
}
}
Regards
Gav
> Hi
>
[quoted text clipped - 7 lines]
>
> /Andreas