Autor Beitrag
seppel86
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54



BeitragVerfasst: So 08.02.04 16:28 
Hi, ich hab ja schon einen Nacht lang nix mehr gefragt, aber jetzt muss es sein. Ich hab in meinem Programm insgesamt 2Forms und 3 Units. Unit3 ist allgemein, unit1 und 2 beziehen sich auf die Formulare. Ich hab nun für den Button1 in Form1/Unit 1 stehen:
ausblenden Delphi-Quelltext
1:
2:
form2.show;
form1.hide;
und im interface natürlich uses unit2.

Wenn ich den Button drücke zeigt er aber statt Form 2 nur einen Error an:
Zitat:
Access Violation at adress ...


Moderiert von user profile iconTino: Delphi- & Quote-Tags hinzugefügt.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 08.02.04 16:32 
Kuck mal in den Projekt-Optionen, ob das Formular2 bei den automatsich erzeugten Formularen steht. Wenn nicht, entweder zur Laufzeit erzeugen oder zu den automatisch erzeugten Formularen hinzufügen.
seppel86 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54



BeitragVerfasst: So 08.02.04 16:36 
ja steht drin
seppel86 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54



BeitragVerfasst: So 08.02.04 16:43 
wenn ich das Programm mit Trace Into laufen lasse, meldet er den Fehler genau bei dem Befehl Form1.show;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 08.02.04 16:52 
Zeig mal Code und auch, wie das OnCreateEreigniss der Form2, eventuell geht da was schief.
seppel86 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54



BeitragVerfasst: So 08.02.04 17:06 
Ok, hier is der Code für Unit eins und 2
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:
38:
39:
40:
41:
42:
unit Unit1;

interface

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

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

var
  FormStart: TFormStart;

implementation

{$R *.dfm}

procedure TFormStart.Button1Click(Sender: TObject);
begin
     if RadioButtonSingle.Checked=true then
     begin
        {Hier stehen die Befehle, um ein Spiel an einem Rechner zu starten}
        Form1.show;
        FormStart.Hide;
     end;
     if RadioButtonLan.Checked=true then
     begin
        {Hier stehen die Befehle, um ein Spiel über Lan zu starten.}
     end;
end;

end.

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:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
unit Unit2;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    ButtonStart: TButton;
    StringGrid1: TStringGrid;
    Image1:TImage;
    Label4: TLabel;
    Label6: TLabel;
    Label5: TLabel;
    Label8: TLabel;
    buttonmatchclose: TButton;
    ButtonClose: TButton;
    Label9: TLabel;
    StringGrid2: TStringGrid;
    Label10: TLabel;
    Label11: TLabel;
    Label7: TLabel;
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1Click(Sender: TObject);
    procedure ButtonStartClick(Sender: TObject);
    procedure Kreis(Sender:TObject);
    procedure X(Sender:TObject);
    procedure rundebeendet(Sender:TObject);
    procedure feldzeichnen(Sender:TObject);
    procedure buttonmatchcloseClick(Sender: TObject);
    procedure ButtonCloseClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Feldreset(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  spieler1,spieler2 :String;
  i: Integer;
implementation

uses unit3;


Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.