Autor Beitrag
Kroni
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: So 19.03.06 14:39 
Tag Community...
Ich habe hier meine Unit mit folgendem Inteface:
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 ladenundeingeben01;
//Temperatureinstellung, Speichern und Laden
interface

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

type
  TForm2 = class(TForm)
    pb1: TPaintBox; sb1: TScrollBar; sb2: TScrollBar;
    Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel;
    Label6: TLabel; Label7: TLabel; Label8: TLabel; Label1: TLabel;
    ComboBox1: TComboBox; ComboBox2: TComboBox; Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure zeichnen(sender: TObject);
    procedure Linien;
    procedure Scrollbarschange(Sender: TObject);
    procedure laden;
    procedure speichern;
    procedure Button1Click(Sender: TObject);
    procedure vorlageladen;
    procedure ComboBox2Change(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private { Private-Deklarationen }
  public { Public-Deklarationen }
  vt:Array[1..9,1..24]of integer;
  end;

var Form2: TForm2;

Nu habe ich diese Unit kompiliert, und binde sie in meinem Programm so ein:

ausblenden Delphi-Quelltext
1:
2:
3:
implementation
{$R *.dfm}
uses thermometer, ladenundeingeben01;


So, dann möchte ich folgendermaßen auf die Variable, die im oberen Code unter Public deklariertem Array zugreifen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var i,j:integer;
begin
ladenundeingeben01.TForm2.Create(self);
for i:=1 to 9 do
 begin
 for j:=1 to 24 do
  VT[i,j]:=ladenundeingeben01.VT[i,j];
 end;
end;

Hat jemand ne Ahnung, warum der mir dann sagt, dass VT ein undefinierter Bezeichner sei?
Weil auf dat
ladenundeingeben01.TForm2.Create(self); reagiert der ja


Hoffe, ich habe euch genug infos gegeben...

Slaínte

Kroni
Grishnak
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 221

Windows XP Home
Delphi 7 PE, Delphi 2005 PE
BeitragVerfasst: So 19.03.06 15:50 
VT ist eine Eigenschaft von "TForm2" und keine Variable der Unit "ladenundeingeben01"!

Du musst sie deshalb auch per "Form2.VT[]" ansprechen!

_________________
Mach' etwas idiotensicher und irgendjemand erfindet einen besseren Idioten!
Kroni Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: So 19.03.06 16:07 
DAnke, funktionierT!