How to load array items in the list box?

1

I have TCheckListBox and when it is checked I save the options in an Array. I need to click on a "List" button, Array elements (marked options of TCheckListBox ) are listed in TListBox .

It should look something like this:

    
asked by anonymous 13.01.2016 / 15:27

1 answer

1

For this we will go through all TCheckListBox looking for the marked items, and we will add one by one in TListBox .

Following procedure:

void __fastcall frmTeste::btnTesteClick(TObject *Sender)
{
  ListBox1->Clear(); //Limpando a Lista
  for (int i = 0; i < CheckListBox1->Count; i++)
  {
    if (CheckListBox1->Checked[i]) //Para cada 1 que estiver maarcado...
      ListBox1->Items->Add(CheckListBox1->Items->Strings[i]); //...Adiciona na lista
  }
}
    
13.01.2016 / 22:16