Autor Beitrag
Hasche
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: So 20.01.08 01:47 
Ich wollte einen in einer Datei abgespeicherten Text bei Buttonklick in ein Editfeld laden.

Hatte es so ungefähr mit Edit1.Text.LoadFromFile('lala.txt') probiert, aber die Möglichkeit gibt es in Delphi ja leider nicht ^^

Deswegen meine Frage.. Ist das möglich? Wenn ja, wie programmier ich das?
Danke


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 20.01.2008 um 22:47
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: So 20.01.08 01:55 
Entweder in einer TStringList zwischenspeichern.
Alternativ: Stichwort TIniFile.
Hasche Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: So 20.01.08 02:06 
ich hab mir ja echt alle mühe gegeben, aber sry, die suche hat mir nicht weiter geholfen.. bin genauso schlau wie vorher.. xD

was du mir sagen willst mit dem zwischenspeichern etc hab ich verstanden, nur scheiterts wieder mal an der umsetzung :)
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 20.01.08 02:06 
Vieleicht solltest Du Dir erst mal dieses zu Gemüte führen. :wink:
www.christian-stelzm...=tutorials_crashkurs

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Hasche Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: So 20.01.08 14:31 
sry, ich blick da als anfänger 0 durch o.ô
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: So 20.01.08 14:35 
Möglicherweise hat dir user profile iconBlackheart666 deshalb den Link zu user profile iconChristian S.' Crashkurs gegeben. :wink:
Kri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 118



BeitragVerfasst: So 20.01.08 14:50 
Hi,

simpelste Variante wird wohl sein:

Laden: (z.B. Button1)
ausblenden Delphi-Quelltext
1:
2:
3:
ListBox1.Clear;                            //Inhalt von ListBox1 löschen
ListBox1.Items.Add(Edit1.Text);            //Text von Edit 1 in ListBox1 schreiben
ListBox1.Items.SaveToFile('blabla.txt');   //Inhalt von LB in blabla.txt speichern


Speichern: (z.B. Button2)
ausblenden Delphi-Quelltext
1:
2:
ListBox1.Items.LoadFromFile('blabla.txt'); //Inhalt von LB in blabla.txt laden
Edit1.Text:=ListBox1.Items[0];             //Erstes Item von LB in Edit1 laden


Wahlweise noch ListBox1.Visible:=false in Form1.Create.

Grüße
Kri
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: So 20.01.08 15:03 
Sorry, aber eine unsichtbare Listbox zum Laden einer Zeile Text erscheint mir ziemlich sinnlos.

@user profile iconHasche: Schau dir mal in der OH die Befehle AssignFile, Reset und CloseFile an.
Kri
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 118



BeitragVerfasst: So 20.01.08 15:46 
Hehe ok du hast recht, mein Fehler.

Grüße
Kri
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 20.01.08 22:40 
kannst auch serialisieren... hier: www.delphipraxis.net...st827850.html#827850 hatte ich mal ein beispiel gepostet... <HTH>
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Mo 21.01.08 00:02 
user profile iconnagel hat folgendes geschrieben:
Sorry, aber eine unsichtbare Listbox zum Laden einer Zeile Text erscheint mir ziemlich sinnlos.

@user profile iconHasche: Schau dir mal in der OH die Befehle AssignFile, Reset und CloseFile an.


Dann wohl eher eine TStringList im private-Bereich der Formularklasse. :) Aber mir scheint der Threadersteller möchte eine schnelle Lösung, ohne etwas dafür tun zu müssen. :roll: Aber bitt erstmal die Grundlagen lernen. Die angegbenen Quellen sollten dazu ausreichend Stoff bereit stellen. ;) Es ist noch kein Programmiermeister vom Himmel gefallen. :lol:

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen