Witam,
Mam pola ListBox (jest w nim zapisany jednen tekst) i Edit oraz przyciski dodaj i czyść (listboxa).
Poniższą procedura sprawdzam czy dodawany tekst (pole edit) istnieje już w LixtBoxie. Jeżeli nie istnieje, to jest dodany do listy. W przeciwnym wypadku pojawia się stosowny komunikat.
Wszystko działa jednak, gdy pole ListBox jest puste to nie mogę dodać tesktu z pola Edit.
Procedura:
procedure TForm1.Button10Click(Sender: TObject);
var
I : Integer;
FullName : String;
begin
FullName:= IncludedEdit.Text;
for i := 0 to FilesIncluded.Items.Count - 1 do
begin
if FilesIncluded.Items.IndexOf( FullName ) > 0 then
begin
showmessage('Maska "' + FullName + '" już istnieje!');
Exit;
end
else
if FilesIncluded.Items.IndexOf( FullName )