Autor Beitrag
Michael15
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:10 
Hallo alle zusammen...
wie kann ich es mit erreichen, dass wenn man auf einen Button drückt,der Text welcher im edit feld steht in eine listbox übertragen wird. Mit array. Wichtig, der quelltext darf nur kurz sein. Danke Michael
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 18:16 
Hmm?? Was haben denn Arrays damit zu tun?? Die bei Items?? kA.. ;)

ausblenden Delphi-Quelltext
1:
ListBox1.Items.Add(Edit1.Text);					


So müsste das auf jeden Fall gehen.. ;)
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:22 
z.b. der Name 'Hansi Mops', der soll in ein edit feld geschrieben werden, und wenn man auf einen Button (Caption übertragen) klickt soll der Name Hansi Mops im Richedit stehen
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 18:25 
:shock: Wo kommt denn jetzt das RichEdit her???? :?
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:26 
sorry ich meinte list box. sorry
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 18:28 
Und so wie's da oben steht geht es nicht??
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:30 
doch, aber wie erreiche ich das jetzt, dass der die Liste der ListBOX jetzt speichert??? Wenn man auf einen anderen Button klickt??? Danke
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 15.03.05 18:32 
ausblenden Delphi-Quelltext
1:
Listbox1.items.savetofile('Dateiname');					

und bevor du fragst:
ausblenden Delphi-Quelltext
1:
Listbox1.items.loadfromfile('Dateiname');					

liest die Daten wieder ein.

EDIT: Korrektur
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:34 
yo danke, aber wie öffnet man das dialogfenster speichern und weist ihm die aktion zu???
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 18:36 
Ohne dir zu nahe zu treten... ;) Hast du schon mal drüber nachgedacht, dir ein Buch zu kaufen?? ;)

ausblenden Delphi-Quelltext
1:
2:
SaveDialog1.Execute;
ListBox1.Items.SaveToFile(SaveDialog1.FileName);


^^nur grob...


;)
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:39 
die meisten verstehe ich nicht. Danke für deine Hilfe
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 15.03.05 18:40 
Da benötigst du die Komponente TSaveDialog.
ausblenden Delphi-Quelltext
1:
2:
  if SaveDialog1.Execute then
    listbox1.items.savetofile(savedialog1.filename);

Habs nicht getestet. Kein Delphi parat.

Entsprechend gibt es ein TOpenDialog.
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 18:40 
Schau doch einfach mal im Forum unter Tutorials nach!! ;) Da gibt's wirklich gute! ;)

//EDIT: :rofl: jasocul... :lol: Cooler Beitrag... ;)
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:48 
danke an alle..., aber
wenn ich nur ein "rray [10] of string [20] eingeben und speichern will?
Was mache ich dann???
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 15.03.05 18:54 
Dich mit INI-Dateien oder Textdateien oder Streams oder typisierten Dateien beschäftigen.
Deine Frage lässt sich nicht pauschal beantworten. Vermutlich wäre eine Textdatei die beste Lösung.

@WeBsPaCe:
Was meinst du?
Michael15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 76

Win XP Professional
Delphi 2, 3, 7, 8
BeitragVerfasst: Di 15.03.05 18:55 
ja wie mache ich das mit der texdatei???
PattyPur
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 80

Win98, WinXP
Delphi 7
BeitragVerfasst: Di 15.03.05 18:57 
wirf mal einen Blick in die Delphi-Online Hilfe: Stichwort Assignfile

_________________
Das Leben ist zum Spielen da,
alles andere ist Unsinn
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 15.03.05 19:00 
user profile iconjasocul hat folgendes geschrieben:
@WeBsPaCe:
Was meinst du?

Schau mal bei deinem einen Beitrag zwei Posts nach oben... ;)
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 15.03.05 19:01 
Die Delphi-Hilfe schreibt in einem Beispiel zum Einlesen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var 
  F: TextFile;
  S: string;
begin
  if OpenDialog1.Execute then          { Dialog zum Dateiöffnen anzeigen }
  begin
    AssignFile(F, OpenDialog1.FileName);   { Datei ausgewählt }
    Reset(F);
    Readln(F, S);                          { Erste Zeile der Datei lesen }
    Edit1.Text := S;                       { String in ein TEdit schreiben }
    CloseFile(F);
  end;
end;


Zum Erzeugen einer Datei und reinschreiben benötigst du statt reset und readln die Anweisungen Rewrite und Writeln.
Die Schleife für dein Array darfst du jetzt aber selbst schreiben.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 15.03.05 19:04 
user profile iconWeBsPaCe hat folgendes geschrieben:
user profile iconjasocul hat folgendes geschrieben:
@WeBsPaCe:
Was meinst du?

Schau mal bei deinem einen Beitrag zwei Posts nach oben... ;)

Weil du schneller warst? Du kannst ja auch mal Glück haben. :wink: