ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
4714
4714
EMPFEHLEN
-
27.09.07 10:39 #1
- Registriert seit
- Sep 2007
- Beiträge
- 1
Ich habe eine software geschrieben die den Inhalt der Listview in Records speichert di werden später auf eine Datei gschrieben .txt leider kann ich di jezt nich laden ich null ahnung bin neu in diesem gebiet helft mir bitte
PHP-Code:unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
btnLaden: TButton;
btnSpeichern: TButton;
GroupBox1: TGroupBox;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
btnKsp: TButton;
Label5: TLabel;
Edit5: TEdit;
Label6: TLabel;
Label7: TLabel;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
procedure btnKspClick(Sender: TObject);
procedure btnSpeichernClick(Sender: TObject);
procedure btnLadenClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyRecord = record
name, vorname, adresse, plz, ort: String[30];
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnKspClick(Sender: TObject);
var
listitem:Tlistitem;
Kunden_anzahl: Integer;
begin
label7.Caption :='Anzahl Kunden = ' + IntToStr(ListView1.Items.Count);
ListItem:=TlistItem.Create(ListView1.Items);
ListItem.SubItems.Add(Edit1.text);
ListItem.SubItems.Add(Edit2.text);
ListItem.SubItems.Add(Edit3.text);
ListItem.SubItems.Add(Edit4.text);
ListItem.SubItems.Add(Edit5.text);
ListView1.Items.AddItem(ListItem);
Edit1.Text:='';
Edit2.Text:='';
Edit3.Text:='';
Edit4.Text:='';
Edit5.Text:='';
end;
procedure TForm1.btnSpeichernClick(Sender: TObject);
var
MyRecord: TMyRecord;
f:file of TMyRecord;
x:integer;
lItem: TListItem;
begin
assignfile(f,'C:\Var.txt');
rewrite(f);
begin
for x := 0 to ListView1.Items.Count-1 do
begin
lItem := ListView1.Items[x];
FillChar(MyRecord, SizeOf(MyRecord), #0);
MyRecord.name := lItem.SubItems[0];
MyRecord.vorname := lItem.SubItems[1];
MyRecord.adresse := lItem.SubItems[2];
MyRecord.plz := lItem.SubItems[3];
MyRecord.ort := lItem.SubItems[4];
Write(f,MyRecord);
end;
closefile(f)
end;
end;
procedure TForm1.btnLadenClick(Sender: TObject);
var
f:file of TMyRecord;
MyRecord: TMyRecord;
lItem: TListItem;
x:Integer;
begin
assignfile(f,'C:\Var.txt');
reset(f);
for x := 0 to ListView1.Items.Count-1 do
begin
read(f,MyRecord);
lItem := ListView1.Items[x];
lItem.SubItems[0]:= MyRecord.name;
lItem.SubItems[0]:= MyRecord.vorname;
lItem.SubItems[0]:= MyRecord.adresse;
lItem.SubItems[0]:= MyRecord.plz;
lItem.SubItems[0]:= MyRecord.ort;
end;
closefile(f)
end;
(*assignfile(f,'C:\Var.txt');
reset(f);
repeat
read(f,MyRecord);
lItem.SubItems[0] := MyRecord.name ;
until eof(f);
closefile(f)
end; *)
end.
Ähnliche Themen
-
XML-Datei lesen und als String speichern
Von cologna77 im Forum JavaAntworten: 8Letzter Beitrag: 05.02.10, 15:18 -
Vector Objekt in Datei speichern / lesen
Von kjk im Forum JavaAntworten: 5Letzter Beitrag: 28.10.06, 17:52 -
[C++] Vector in Datei speichern / aus Datei lesen
Von Fabian im Forum C/C++Antworten: 3Letzter Beitrag: 28.06.05, 08:59 -
Xml Datei lesen und in Hashtable speichern
Von liam im Forum .NET ArchivAntworten: 0Letzter Beitrag: 18.01.05, 19:47 -
Zeilenweise speichern + lesen in txt Datei
Von RazOrde im Forum JavaAntworten: 1Letzter Beitrag: 27.04.04, 09:56





Zitieren
Login





