I like David's version but why not get rid of the "not" to: DBCheckBox4.Enabled := DBEdit2.Text <> '';
Cheers, On 27 April 2010 09:40, Ian Drower <idro...@gmail.com> wrote: > Hi Bob > I'd use > if DBEdit2.Text <> '' then > DBCheckBox4.Enabled := true > else > DBCheckBox4.Enabled := false > > Ian > > > > On 27/04/2010 10:52 a.m., David O'Brien wrote: > > Why the four quotes in the false and a space in the true? > > > > I would use something like: > > > > DBCheckBox4.Enabled := not (DBEdit2.Text = '') ; > > > > *From:* delphi-boun...@delphi.org.nz > [mailto:delphi-boun...@delphi.org.nz<delphi-boun...@delphi.org.nz>] > *On Behalf Of *Bob Pawley > *Sent:* Tuesday, 27 April 2010 10:39 a.m. > *To:* NZ Borland Developers Group - Delphi List > *Subject:* [DUG] Enable CheckBox > > > > Hi > > > > I am attempting to enable a checkbox only when a DBEdit has a value. > (Disabled when no string in DBEdit.) > > > > Following is my code which disables the CheckBox after a delete from the > DBEdit. > > > > But it is not enabled when I add a string to the DBEdit. > > ------ > > procedure TForm4.DBEdit2Change(Sender: TObject); > begin > > > > if > DBEdit2.Text = ' ' > > > > then > DBCheckBox4.Enabled := True > > > > Else if DBEdit2.Text = '''' > > > > then > DBCheckBox4.Enabled := False ; > > > > end; > > > > Thanks for any help. > > > > Bob > > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe > > > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe >
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe