Thema: Delphi Problem mit 3 Formularen

Einzelnen Beitrag anzeigen

blackdead

Registriert seit: 7. Okt 2007
1 Beiträge
 
#3

Re: Problem mit 3 Formularen

  Alt 2. Jun 2008, 20:08
Also ein bischen Code wäre schonmal nicht schlecht...
Sonst guck docherstmal ob du auch in den beiden Formen(Form1, Form2) die Unit von Form3 implementiert hast und vergewissere dich das du auch den Formnamen vor das label sezt, welches du verändern möchtest.

Hier ein kleines Beispiel, funktioniert so wunderbar:

Form1:
Delphi-Quellcode:
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-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation
uses Unit3;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form3.Label1.Caption := 'WAS AUCH IMMER';
end;

end.
Form2:
Delphi-Quellcode:
unit Unit2;

interface

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

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

var
  Form2: TForm2;

implementation
uses Unit3;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  Form3.Label2.Caption := 'NOCH EIN LABEL TEXT';
end;

end.
Form3:
Delphi-Quellcode:
unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form3: TForm3;

implementation

{$R *.dfm}

end.
  Mit Zitat antworten Zitat