Article View: borland.public.delphi.winforms.controls.using
Article #215Re: DataBinding problem
From: Joanna Carter [TeamB]
Date: Mon, 24 Jul 2006 14:16
Date: Mon, 24 Jul 2006 14:16
40 lines
2233 bytes
2233 bytes
"Peter Morris [Droopy eyes software]" <pete@NO_droopyeyes_SPAM.com> a οΏ½crit dans le message de news: 44bd3a9a@newsgroups.borland.com... |I have a datagrid that is bound to a list of objects (with only 1 object in | the list). | | If I edit the Name column of the object in the grid the value is not updated | until I leave the cell. I need to ensure that all changes are applied | before the form closes so this is what I tried in the Form.Closing event | | procedure TWinForm1.TWinForm1_Closing(sender: System.Object; e: | System.ComponentModel.CancelEventArgs); | var | Control: System.Windows.Forms.Control; | BC: System.Windows.Forms.BindingManagerBase; | begin | MessageBox.Show(ACountry.Name); | for Control in Controls do | begin | BC := BindingContext[Control]; | BC.EndCurrentEdit; | end; | MessageBox.Show(ACountry.Name); | | ACountry is a reference to the only object in the list, but both | MessageBox.Show commands display the original value. When I reopen the form | I see the new value I typed has been accepted. | | Can anyone tell me how to apply pending data changes immediately? In order to use BindingContext[...].EndCurrentEdit, your classes must implement IEditableObject. Joanna -- Joanna Carter [TeamB] Consultant Software Engineer
Technical Details
Message-ID:
<44c4d63c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44bd3a9a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,59b0e43f2ff78e0c X-Google-Attributes: gid1eff29,public X-Google-Language: ENGLISH,ASCII From: "Joanna Carter [TeamB]" <joanna@not.for.spam> Newsgroups: borland.public.delphi.winforms.controls.using References: <44bd3a9a@newsgroups.borland.com> Subject: Re: DataBinding problem Date: Mon, 24 Jul 2006 15:16:21 +0100 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 82.69.239.102 Message-ID: <44c4d63c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1153750588 82.69.239.102 (24 Jul 2006 07:16:28 -0700) X-Authenticated-User: jcarter Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail