cancel
Showing results for 
Search instead for 
Did you mean: 

Adding items to combobox during runtime

mailtosarojjena
Occasional Contributor

Adding items to combobox during runtime

How to add items in combo box during run time
3 REPLIES 3
AlexKaras
Community Hero

RE: Adding items to combobox during runtime

Hi Saroj,



"TcxComboBox Object" TestComplete help topic if you are talking about TcxComboBox User Forms component.

More information is appreciated otherwise.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
mailtosarojjena
Occasional Contributor

RE: Adding items to combobox during runtime

 Yes,I am talking about TcxComboBox Object,

There is no property exists to add items(items stored in array) to combobox during runtime

Plase see the attachment
AlexKaras
Community Hero

RE: Adding items to combobox during runtime

Hi Saroj,



Doesn't the following code (sample from the 'Items Property' help topic) work for you?

Note that the help topic mentiones that the code works from the OnShow event, maybe control becomes read-only after being initialized?

===============

procedure UserForm1_OnShow(Sender);

begin

  with UserForms.UserForm1.cxComboBox1.Properties.Items do

  begin

    Add('Item1');

    Add('Item2');

    Add('Item3');

    Add('Item4');

    Add('Item5');

  end;

  // Note that you can also use any of the following --


  // Specify the comma-separated item list

  // UserForms.UserForm1.cxComboBox1.Properties.Items.CommaText := 'Item1,Item2,Item3,Item4,Item5';


  // Specify the item list separated by new line symbols

  // UserForms.UserForm1.cxComboBox1.Properties.Items.Text :=

  //     'Item1'#13#10'Item2'#13#10'Item3'#13#10'Item4'#13#10'Item5';

end;

===============

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors