Autor Beitrag
Ralf Nestle
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Di 29.03.05 18:15 
Hallo zusammen,
bin Anfänger und habe folgende Propleme.

Frage 1 wie kann man auf Editfelder in einem 2 Formular zugreifen

Frage 2 wie kann man die Daten (2 Editfelder) in eine .txt Datei speichern so dass der Dateiname nicht fest vergeben wird

Ein kleines Beispiel wäre toll

Gruss
Ralf


Moderiert von user profile iconAXMD: Topic aus Sonstiges verschoben am Di 29.03.2005 um 19:17
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: Di 29.03.05 18:18 
:welcome:

Schon mal unsere Forensuche versucht ;)

AXMD
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 29.03.05 18:18 
Auf ein Edit-Feld zugreifen ist relativ einfach. Sieht dein Prog am Anfang ungefähr so aus:
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Edit1.Text := 'hallo';
end;

end.

Machen wir daraus sowas:
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Edit1.Text := 'hallo';
end;

end.

;)

Die zweite Frage versteh ich nich so ganz... ;)
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: Di 29.03.05 18:21 
user profile iconWeBsPaCe hat folgendes geschrieben:
Die zweite Frage versteh ich nich so ganz... ;)


Ich glaube, er möchte uns damit sagen, dass er den Inhalt zweier Editfelder in einer Datei gespeichert werden soll, deren Name erst zur Laufzeit feststehen soll. @Ralf: siehe hierzu Suche in: Delphi-Forum, Delphi-Library SAVEDIALOG ;)

AXMD
Ralf Nestle Threadstarter
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Di 29.03.05 19:19 
Hallo,
das ging schnell

Nochmal wegen speichern

Es sind 2 Editfelder habe folgendes versucht

ausblenden Delphi-Quelltext
1:
2:
3:
4:
begin
SaveDialog1.Execute;
Edit1.Text.SaveToFile(SaveDialog1.Filename);
end;


geht aber nicht und das 2 Feld fehlt auch noch.

Gruss
Ralf

PS.:Im Forum habe ich sowas nicht gefunden

Moderiert von user profile iconAXMD: Delphi-Tags hinzugefügt.
Chris Maslowski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 109



BeitragVerfasst: Di 29.03.05 19:29 
Probiers Mal mit dem Speichern in eine INI Datei. Da ist ein tolles Tutorial :D
Blackheart
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 164

ME
D3Prof.-D6Standard
BeitragVerfasst: Di 29.03.05 20:07 
Aus deinen Fragen wird man nicht schlau, gib doch mal an was du so ungefähr vor hast. Willst du den String im Edit irgendwo speichern und später wieder aufrufen ?
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 01.04.05 17:59 
Ich vermute, er will einfach den Text 2er Edits in eine Datei speichern. Wenn dem so ist, dann musst du eine Buffervariable verwenden, in die du die Inhalte der Edits zwischenspeicherst. soll der Inhalt der Datei später etwa so aussehen:
ausblenden Quelltext
1:
2:
TextAusEdit1
TextAusEdit2

benutzt du einfach diesen Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var s:TStringList;
begin
  if Savedialog1.Execute then
  begin
   s:=TStringList.Create;
   s.Add(Edit1.Text);
   s.Add(Edit2.Text);
   s.SaveToFile(SaveDialog1.Filename);
   s.free;
  end;
end;


Das sollte weiterhelfen.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.