TAdvDBComboBox

I have set the "DisplayedValue" / "Stored value" pair - 7 items in total

If I want to change the "Displayed" value in runtime - how can this be done?

Ex.:
Displayed Stored
Low 0
Medium 1
High 2
... (design time)

But in runtime, I need to modify the displayed value f.ex.:
Niedrig 0
Mittel 1
Hoch 2
... (in runtime)
If I execute 
MyDBCombobox.Items[1]:='Niedrig';
MyDBCombobox.Items[2]:='Mittel';
MyDBCombobox.Items[3]:='Hoch';

There are added another 3 items in the list, and the original persists.
How can I modify the displayed value in runtime?

br.
Anders Balslev



I cannot reproduce this here.

I added 3 items at design-time and then have at runtime:

procedure TForm1.Button1Click(Sender: TObject);
begin
  AdvDBComboBox1.Items[0] := 'Niedrig';
  AdvDBComboBox1.Items[1] := 'Mittel';
  AdvDBComboBox1.Items[2] := 'Hoch';

  outputdebugstring(pchar(advdbcombobox1.Items.Count.ToString));
end;

and I still see 3 items and it reports also that Items count is still 3.

Do you use the latest version of this component?

Hi Bruno

I'm not sure I use the latest version.
I run Delphi XE2.
The component version is:
1.0.4.0

The latest version is v1.0.4.1.

There has been a fix in this version with respect to internal string list handling.
In the OPs code, the assignment indexes are off by one - 1,2,3 rather than 0,1,2.

Some kind of memory overwrite corrupting the list?

Did you test with v1.0.4.1?

Yes, I did try.

Unfortunately the problem still persists.
I have made a small demo program that shows the problem
How can I upload this small program for you?
br.
Anders

Please send it by email

https://www.tmssoftware.com/site/support_mail.asp 

A separate mail with demo project attached is sent.

br.
Anders