Autor Beitrag
csigg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 29.03.05 10:40 
ich hab ein Problem, ich hab 2 Forms (pas_frm_main, pas_Spezialisten).
in der pas_Spezialisten hab ich eine Variable als public deklariert:
ausblenden Delphi-Quelltext
1:
auswahl: int;					

Nun möchete ich von der Main aus drauf zugreifen, aber mit
ausblenden Delphi-Quelltext
1:
frm_Spezialisten.auswahl					

geht es nicht, knn mir da jemand helfen??
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Di 29.03.05 10:45 
Hast du Speziallisten in den uses-Teil der Main hinzugefügt?

Übrigens: Diese Frage gibt es im Forum schon 21598 mal...
jaevencooler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 166
Erhaltene Danke: 6

MS-DOS,Win32, Win95, Win 98, Me,XP, Linux, NT4.0, NT 2000-2008, Vista, Windows 7
Turbo Pascal,D1 Enter,D2 Enter,D3 Enter,D5 Enter, Kylix, D2007, PL/SQL, MS/SQL, Delphi 2010, Delphi XE
BeitragVerfasst: Di 29.03.05 10:58 
Guten Morgen,


Bitte denke auch daran die Variablen im "Public" - Teil der Form zu deklarieren...


user profile iconcsigg hat folgendes geschrieben:
ich hab ein Problem, ich hab 2 Forms (pas_frm_main, pas_Spezialisten).
in der pas_Spezialisten hab ich eine Variable als public deklariert:
ausblenden Delphi-Quelltext
1:
auswahl: int;					

Nun möchete ich von der Main aus drauf zugreifen, aber mit
ausblenden Delphi-Quelltext
1:
frm_Spezialisten.auswahl					

geht es nicht, knn mir da jemand helfen??


Beste Grüße
Michael

_________________
Wissen ist Macht, nichts wissen macht auch nichts...
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 29.03.05 11:03 
die deklaration steht unter public, geht aber nicht :(
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Di 29.03.05 11:07 
Was heisst den nun geht nicht!
Was für ne Meldung erscheint?
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Di 29.03.05 11:22 
hier mal ein einfaches komplettbeispiel:

ausblenden 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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    test:integer;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  form1.test:=5;
end;

end.


ausblenden 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:
unit Unit2;

interface

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

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

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
  form1.test:=10;
end;

end.


noch fragen? :tongue:

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 29.03.05 12:00 
das müsste ich so haben

pas_frm_Main:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
 
uses ..., pas_Spezialisten, ...;
...
frm_Spezialisten.auswahl := 4;
...


pas_Spezialisten:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
public
     auswahl: Integer;
...
auswahl := 1;


Fehlermeldung:
[Fehler] pas_frm_Main.pas(1296): Undefinierter Bezeichner: 'frm_Spezialisten'
[Fehler] pas_frm_Main.pas(1296): Operator oder Semikolon fehlt
[Fataler Fehler] LooknBook.dpr(14): Verwendete Unit 'pas_frm_Main.pas' kann nicht compiliert werden
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 29.03.05 12:06 
Wenn du es wirklich so gemacht hat, wie es da steht, gibt es die Variable frm_Spezialisten nicht.
Der Rest sind Folgefehler.
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 29.03.05 12:09 
OK, stimmt. Das hab ich ganz Übersehn. Aber wie bekomm ich das jetzt hin das es trotzdem geht??
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 29.03.05 12:11 
user profile iconcsigg hat folgendes geschrieben:
OK, stimmt. Das hab ich ganz Übersehn. Aber wie bekomm ich das jetzt hin das es trotzdem geht??

Indem du die richtige Variable benutzt, bzw. diese erstmal deklarierst?
csigg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 706

WIn XP, Win NT, Win2000, Suse8.0
Delphi 5, Delphi 6
BeitragVerfasst: Di 29.03.05 12:13 
OK, habs rausgefunden, jetzt klappts.