Forum Discussion

mailtosarojjena's avatar
mailtosarojjena
Occasional Contributor
14 years ago

Adding items to combobox during runtime

How to add items in combo box during run time

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    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;

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

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Saroj,



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

    More information is appreciated otherwise.
  • mailtosarojjena's avatar
    mailtosarojjena
    Occasional Contributor
     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