Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2005

Tip: Looking for answers? Try searching our database.

How commit databindings on instant form closing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andreas Zita - 24 Aug 2005 22:25 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.