🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages Started by Star Wed, 25 Jul 2007 19:04
Changing displaying value with TDBComboBox
#233
Author: Star
Date: Wed, 25 Jul 2007 19:04
16 lines
1370 bytes
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
#234
Author: Giuliano
Date: Thu, 26 Jul 2007 07:55
23 lines
1678 bytes
Il Wed, 25 Jul 2007 15:04:59 -0400, Star <noemai@noemail.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
Re: Changing displaying value with TDBComboBox
#235
Author: Star
Date: Thu, 26 Jul 2007 14:17
25 lines
1916 bytes
Thanks a lot, Giuliano. I'll try that.

Giuliano wrote:
> Il Wed, 25 Jul 2007 15:04:59 -0400, Star <noemai@noemail.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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads