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: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107:
| unit Eintrag;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; ListBox1: TListBox; name: TEdit; alter: TEdit; speichern: TButton; Edit1: TEdit; Edit2: TEdit; procedure Button3Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure ListBox1Click(Sender: TObject); procedure speichernClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private public end;
var Form1: TForm1; searchResult:TSearchRec; name,alter,bearbeiten,filename:shortstring; data:textfile; listboxindex:integer;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); begin if FindFirst('*.txt', faAnyFile, searchResult) = 0 then repeat listbox1.items.add(searchResult.Name); until FindNext(searchResult) <> 0;
end;
procedure TForm1.Button1Click(Sender: TObject); begin alter.Visible := true; name.Visible := true; speichern.Visible := true; end;
procedure TForm1.speichernClick(Sender: TObject); begin filename:=name.Text+'.txt'; AssignFile(data,filename); rewrite(data); writeln(data,name.text,',',alter.text); Closefile(data);
listbox1.Clear; if FindFirst('*.txt', faAnyFile, searchResult) = 0 then repeat listbox1.items.add(searchResult.Name); until FindNext(searchResult) <> 0; end;
procedure TForm1.ListBox1Click(Sender: TObject); begin listboxindex:=listbox1.ItemIndex; edit1.Text:=floattostr(listboxindex); Edit2.Text:=ListBox1.Items.Strings[ListBox1.ItemIndex];
end;
procedure TForm1.Button2Click(Sender: TObject); begin alter.Visible := true; name.Visible := true; speichern.Visible := true;
????????????????????????????????????????????? was muss hier hin um die Datei auszulesen ? end;
procedure TForm1.Button3Click(Sender: TObject); var pfad:shortstring; begin pfad:=extractfilepath(application.exename); deletefile(edit2.text);
listbox1.Clear; if FindFirst('*.txt', faAnyFile, searchResult) = 0 then repeat listbox1.items.add(searchResult.Name); until FindNext(searchResult) <> 0; end;
end. |