troubleshooting Question

Assigning a value to TDBEdit.text

Avatar of ahalya
ahalyaFlag for Canada asked on
10 Comments1 Solution5636 ViewsLast Modified:
I seem to get inconsistent behaviour when assigning a value to DBEdit components.  (DBEdit.Text := 'New Text')  Occasionally they show in display, mostly do not. And, they never seem to change the underlying database.

Any text typed by the user works fine.  The only way to make assignment in code work is to assign the value to underlying datafield. (i.e, DBEdit.Datasource.Dataset.FieldByName(DBEdit.FieldName).AsString := 'New Text' works fine. But, isn't that an overkill ?)

A look at the VCL shows that the assignment is executed via the private "SetText" method of TCustomMaskEdit component (which is the ancestor of TDBEdit).  Two questions:

1. Why didn't Borland/CodeGear/mbacardaro add an inherited SetText method to the TDBEdit component ?

2. Can one add SetText method to the TDBEdit component, which simply would set the underlying datafield and then call the inherited method ?  (presumably, VCL has be be tweaked to make the inherited method accessible).  Are there any known side effects to this?

Oh, by the way the TDBCoboBox is also a mess, when it comes to assignment via code :-)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros