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



BeitragVerfasst: Fr 03.01.03 16:06 
Hallo!

Ich möchte ein Fenster erzeugen, in dem eine CheckBox ist, über die entschieden werden kann, ob das Form nochmals angezeigt wird (beim nächsten Start).

ausblenden volle Höhe 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:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
unit eroeffnung;

interface

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

type
  TfrmEroeffnung = class(TForm)
    btnClose: TButton;
    cbShow: TCheckBox;
    Image1: TImage;
    lblShow: TLabel;
    procedure btnCloseClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmEroeffnung: TfrmEroeffnung;
  f:            TextFile;
  s:    String;


implementation

uses Mitglied;

{$R *.dfm}

procedure TfrmEroeffnung.btnCloseClick(Sender: TObject);
begin
frmHaupt.Show;
frmEroeffnung.Hide;
end;

procedure TfrmEroeffnung.FormCreate(Sender: TObject);
begin

//Öffnen der Datei files/show.txt zum Auslesen der Infos
//Diese werden in VAR S geschrieben

AssignFile(f, 'E:\Delphi\Projekt\aktuell\files\show.txt');
Reset (f);
ReadLn(f, s);
lblShow.Caption := s;
CloseFile (f);

if lblshow.Caption ='no' then begin
btnClose.Click;
end else;

end;

end.


Problem bei der ganzen Sache ist, sobald in der Datei "No" steht kommt folgender Fehler:

Zitat:
Projekt Projekt.exe raised exeption class EAccessViolation with Message 'Access violation at adress 00452F72 in module 'Projekt.exe' Read of adress 000002EC. Process stopped. Use steff or run to continue


Irgendwie bin ich im Moment ein bisschen ratlos!

Danke im Voraus!
rassler[/quote]
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Fr 03.01.03 17:03 
Das OnCreate Ereignis wird gleich nach dem Aufruf von Application.CreateForm() bzw. TForm.Create() aufgerufen. Somit ist in TfrmEroeffnung.FormCreate das Formular frmHaupt noch nicht erzeugt.

_________________
Ist Zeit wirklich Geld?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Fr 03.01.03 21:28 
:arrow: Lösung:

ins onshow reinschreiben!
oder ins onpaint

Fiji-Fighter 8)