1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
| procedure TForm2.Button1Click(Sender: TObject); var vfl, ls: String; f: TextFile; li, i: Integer; begin vfl := ExtractFilePath(Application.ExeName) + 'lists\' + ListView1.Selected.Caption + '.vfl'; try AssignFile(f, vfl); Reset(f); ReadLn(f, ls); li := StrToInt(ls); SetLength(Form1.ask, li); SetLength(Form1.answer, li); for i := 1 to li do begin ReadLn(f, Form1.ask[i]); ReadLn(f, Form1.answer[i]); end; Closefile(f); except on E: EInOutError do ShowMessage('Fehler beim lesen der Datei! Fehler-Code: ' + IntToStr(e.ErrorCode)); end; ListView1.Items.Add.Caption := vfl; end; |