Populate ListBox Using TDirectory.GetFiles Delphi XE8 -
does more efficient way of populating listbox file names tdirectory.getfiles exist?
procedure poplistbox(var lb: tlistbox; dir, ext: string; so: tsearchoption); var i: integer; iend: integer; oc: tstringdynarray; begin oc := tdirectory.getfiles(dir, ext, so); iend := length(oc); := 0; repeat lb.items.add(oc[i]); inc(i); until (i > (iend - 1)); end; i input community on approach.
it isn't more efficient, can remove couple of variables , few lines of code:
procedure poplistbox(var lb: tlistbox; dir, ext: string; so: tsearchoption); var oc: tstringdynarray; s: string; begin oc := tdirectory.getfiles(dir, ext, so); lb.items.beginupdate; try s in oc lb.items.add(s); lb.items.endupdate; end; end;
Comments
Post a Comment