Autor Beitrag
Marco15
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 18:22 
Hi !!!

Also, ich habe ein Programm geschrieben bei dem man in ein Editfeld jetzt einen Namen eingibt und der in einer Combobox drin ist.
Wie erreiche ich es jetzt, dass dieser Inhalt auch nach schließen des Programms noch in der Combobox drin ist ???:)


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am So 27.03.2005 um 22:08
SandTarnFarbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26

Win XP, Win 2003 Server
D7 Pers
BeitragVerfasst: So 27.03.05 18:26 
Du kannst entweder den Inhalt auslesen und in eine txt-Datei speichern, die Prozedur sollte beim Beenden aufgerufen werden oder du bindest mehr oder weniger schnell eine Datenbank ein, die den Inhalt aufnimmt und beim nächsten Programmstart wieder ausgibt.
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 18:27 
Weißt du zufälligerweise wie das geht???
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 27.03.05 18:29 
user profile iconMarco15 hat folgendes geschrieben:
Weißt du zufälligerweise wie das geht???


Das Speichern in einer Textdatei? Suche in: Delphi-Forum, Delphi-Library TEXTFILE Suche in: Delphi-Forum, Delphi-Library FILESTREAM Suche in: Delphi-Forum, Delphi-Library SAVETOFILE

AXMD
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 18:32 
Also kann ich das Zugekommene beispielsweise mit savetofile ('...') speichern und beim Programmstart mit loadfromfile ('...') wieder öffnen???
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 27.03.05 18:34 
user profile iconMarco15 hat folgendes geschrieben:
Also kann ich das Zugekommene beispielsweise mit savetofile ('...') speichern und beim Programmstart mit loadfromfile ('...') wieder öffnen???


Eigentlich ja; warum speicherst du nicht alle ComboBoxItems, das ging extrem einfach:

ausblenden Delphi-Quelltext
1:
ComboBox1.Items.SaveToFile('C:\blub.txt');					


AXMD
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 18:35 
Bin ich grade bei. Müsste ja eigentlich klappen.
SandTarnFarbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26

Win XP, Win 2003 Server
D7 Pers
BeitragVerfasst: So 27.03.05 18:37 
Am besten noch SaveToFile nach jedem eingefügten Feld aufrufen, dann musst du es zum Schluß nicht mehr machen und der Inhalt ist gesichert und kann bei einem Absturz nicht verloren gehen!
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 18:38 
Ich bin auf ein weiteres Problem gestoßen !!!
Wie speichere ich den Inhalt eines Editfelds, das brauche ich nämlich auch.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: So 27.03.05 18:41 
user profile iconMarco15 hat folgendes geschrieben:
Ich bin auf ein weiteres Problem gestoßen !!!
Wie speichere ich den Inhalt eines Editfelds, das brauche ich nämlich auch.


Schau dir mal TFileStream an, bevor du noch fragst, wie man RadioButtons und Memos speichert ;). Die Klasse hat eigene Methoden zum Speichern der Eigenschaften von Komponenten. Beispiele findest du hier im Forum zur Genüge

AXMD
SandTarnFarbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26

Win XP, Win 2003 Server
D7 Pers
BeitragVerfasst: So 27.03.05 18:49 
Oder hier noch mal nen bisschen Code:

ausblenden volle Höhe Delphi-Quelltext
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Memo1: TMemo;

    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    T1 : TStrings;
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  T1 := TStringList.Create;
  T1.Text :=  Edit1.Text;
  T1.SaveToFile ('C:\xyz.txt');
end;

end.


Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 19:13 
Und wie kriege ich es hin, dass die einzelnen items dann auch wieder in der Combobox drin stehen?
Also er soll die aus der '.txt' - Datei lesen und wieder dort einfügen.
SandTarnFarbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26

Win XP, Win 2003 Server
D7 Pers
BeitragVerfasst: So 27.03.05 19:22 
mit
ausblenden Quelltext
1:
ComboBox1.Items.LoadFromFile(Filename);					
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 19:27 
Der macht das dann aber erst wenn ich einen Buchstaben eingegeben habe. Vorher ist kein einziger Name in der Combobox...
SandTarnFarbe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26

Win XP, Win 2003 Server
D7 Pers
BeitragVerfasst: So 27.03.05 19:30 
versuch es mal mit
ausblenden Quelltext
1:
combobox1.itemindex := 0; //anstatt -1 (Standardeinstellung)					
Marco15 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win XP Prof.
D2 Schüleredition, D7
BeitragVerfasst: So 27.03.05 19:37 
Es hat geklappt.
Jetzt muss ich nur noch ein paar Feinabstimmungen machen und fertig ist es.
Danke