Ads 468x60px

Smaller time frame always follow the bigger time frame. It's better wait be patience to enter in position than risk with BIG SL. Having strong trading discipline and taking losses when necessary is a sign of serious trading approach

Saturday, August 11, 2012

EASY WAY TO AVOID ADDING DUPLICATE ITEMS TO STRING LISTS


String lists (TStringList) are great -- easy to manage, used by many components such as memos, list boxes, combo boxes, etc., and full of features. Here's how to avoid adding duplicate items to string lists: 
var
  sl : TStringList;
begin
  sl := TStringList.Create;
  with sl do
  begin
    Sorted     := True;
    Duplicates := dupIgnore;

    //
    // add your items here
    // all the duplicate items
    // will be ignored
    //
    Add( edit1.text );
  end;

  //
  // now you can assign the
  // string list with unique
  // items to listbox1 (example)
  //
  listbox1.Items.Assign( sl );

  sl.Free;
end;

comments