Board index » cppbuilder » Changing displaying value with TDBComboBox

Changing displaying value with TDBComboBox


2007-07-26 03:04:59 AM
cppbuilder31
Hi,
I am using a TDBComboBox control for displaying certain field from a
table in a db. The possible values 0..255
What I need to do is instead of displaying the real value from the db,
I have to show that value+1.
e.g. If we have in the database the value 2, the combobox should display 3.
Besides that, if the user select that 3 from the drop-down list, the
value that should be stored in the database will be 2.
Is there an easy way of doing that?
Thanks
 
 

Re:Changing displaying value with TDBComboBox

Il Wed, 25 Jul 2007 15:04:59 -0400, Star < XXXX@XXXXX.COM >ha scritto:
Quote

Hi,

I am using a TDBComboBox control for displaying certain field from a
table in a db. The possible values 0..255
[snip]
Is there an easy way of doing that?
Hi,
have a look at "calculated fields". Create one of that and set the OnGetText and
OnSetText events with appropriate code.
Upon displaying, you have to show a modified version of the value of the real data field.
When you modify the calculated field, you have to reflect the changes onto the data field,
obviously after you have made the appropriate calculations.
This should work fine, especially if you hide the underlying field, setting his Visible
property to false.
Regards
Giuliano
 

Re:Changing displaying value with TDBComboBox

Thanks a lot, Giuliano. I'll try that.
Giuliano wrote:
Quote
Il Wed, 25 Jul 2007 15:04:59 -0400, Star < XXXX@XXXXX.COM >ha scritto:

>Hi,
>
>I am using a TDBComboBox control for displaying certain field from a
>table in a db. The possible values 0..255
[snip]
>Is there an easy way of doing that?

Hi,

have a look at "calculated fields". Create one of that and set the OnGetText and
OnSetText events with appropriate code.
Upon displaying, you have to show a modified version of the value of the real data field.
When you modify the calculated field, you have to reflect the changes onto the data field,
obviously after you have made the appropriate calculations.
This should work fine, especially if you hide the underlying field, setting his Visible
property to false.

Regards

Giuliano
 

{smallsort}