Page 1 of 1

DBComboBox.text POST problem (Delphi2K6)

Posted: 15.09.2006, 06:04
by techie007
Hello all,

I have this strange problem, and it's driving me nuts.

I'm using a TDBComboBox in Delphi, MySQL 5, and the latest stable ZeosLib.

The drop down is pre-populated with static choices.

When the user leaves the combo box I apply formatting functions to the Text property.

These changes show, but once I MySQLQuery.Post they revert back to what they were before I applied my formatting.

Also, say the user hits "c" and it pulls up the first "C" match from the drop down. Say the first match is "Computer Lab", if they hit a lower case C, it shows as "computer Lab". So my Formatting fixes it, and it displays as "Computer Lab" when leaving the box, but it posts it as "computer Lab", and then the box updates from teh record and goes back to displaying "computer Lab".

I have a custom Save button, that checks the pirmary key, and then Posts the record. If I put the formatting procedures in there just before the post, it makes no difference and does the same thing.

I tried replacing my formatting procedures with a simple:

DBCombo.Text := 'foobar';

And it does the same thing, it changes whatever was typed into the box to "foobar", but on Post it reverts back to what it was before "foobar" was assigned.

My SQLQuery beforePost and afterPost events are set to do nothing but enable and disable certain buttons.

ANY ideas?? I'm stumped as to what I'm missing..

Posted: 15.09.2006, 08:55
by mdaems
Maybe you should not set the dbcombo.text property by code but the query.field value. I don't know if the text value is propagated to the dataset the same way as it is done when the user picks a value from the list.
Just a guess. I've no idea if it will work...
Just check before the post if the value is the wrong formatted version and replace it? Does that work?

Mark

Posted: 17.10.2006, 03:52
by techie007
I figured I'd pop in and say thanks.. I finally got some time to continue on with this project, and assigning it via mySQLQuery.FieldByName (as well as updating the text property) worked like a charm.

THANK YOU! :)