|
#1
|
|||
|
|||
Цикл по ListBox
Здравствуйте, подскажите пожалуйста, где-то косячу с циклами.
Есть два ListBox, в ListBox1 допустим 20 items, в ListBox2 1000 aitems, нужно чтобы строки из ListBox перенеслись в ListBox2, но при условии, что в ListBox2 ещё нет такой строки. Делаю так: Код:
procedure TForm1.BbAddDicClick(Sender: TObject); var i, i1 : integer; Key1 : string; begin for i := 0 to ListBox1.Items.Count - 1 do begin Key1 := ListBox1.Items[i]; for i1 := 0 to ListBox2.Items.Count - 1 do if Key1 <> ListBox2.Items[i1] then ListBox2.Items.Add(ListBox1.Items[i]); end; end; Помогите пожалуйста. |