Hello,
I have an issue with a Label.Caption:
- it does not show the right text
- it is not visible every other clicked file
Small background of the application, I drag files into a Listbox, when I select one of them (onclick event) I want to read the textfile and show some data from specific line(s). When there is no file selected, I the labels must be invisible.
The ShowMessage work perfectly and shows the right data, wich should be in the Label.Caption, The Label.Caption displays the original Caption entered in the IDE.
This is the code I have:
procedure TForm1.ListBox1Click(Sender: TObject);
var
i: integer;
NCList: TStringList;
begin
i := ListBox1.ItemIndex;
if i < 0 then
Exit; // -1 means there is no selected item
ProfileLabel.Visible := not ProfileLabel.Visible;
NCList := TStringList.Create;
try
NCList.LoadFromFile(ListBox1.Items[i]);
if NCList.Count = 8 then
ProfileLabel.Caption := NCList[8];
Showmessage(NCList[8]);
finally
NCList.Free;
end;
end;
What am I doing wrong ?