🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #214

DataBinding problem

#214
From: Peter Morris [Droopy eyes softwa...
Date: Tue, 18 Jul 2006 19:46
28 lines
1888 bytes
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?

Pete
Technical Details
Message-ID: <44bd3a9a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,59b0e43f2ff78e0c,start
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Peter Morris [Droopy eyes software]" <pete@NO_droopyeyes_SPAM.com>
Newsgroups: borland.public.delphi.winforms.controls.using
Subject: DataBinding problem
Date: Tue, 18 Jul 2006 20:46:32 +0100
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 82.46.138.4
Message-ID: <44bd3a9a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1153251994 82.46.138.4 (18 Jul 2006 12:46:34 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.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