Hallo,
ich habe eine Form2 die ich so aufrufe:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| procedure TForm1.Button2Click(Sender: TObject); var Options: TForm; begin Options := TForm2.Create(Self); TRY IF (Options.ShowModal = mrOK) THEN FINALLY Options.Free; END; end; |
Dies habe ich hier im Forum gefunden und kopiert. In dieser Form2 habe ich eine Variable (RenDatname) so deklariert:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
| type TForm2 = class(TForm) Label1: TLabel; . . . procedure Button5Click(Sender: TObject); private MPEGaudio: TMPEGaudio; procedure Mp3Laenge(Datname: String); public RenDatname: String; end; |
Diese Variable will ich in Form3 mitbenutzen. Diese form rufe ich ebenfalls wieder mit ShowModal auf:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8:
| Options := TForm3.Create(Self); TRY IF (Options.ShowModal = mrOK) THEN FINALLY Options.Free; END; |
Meine Form3 sieht so aus:
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:
| unit Unit3;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type TForm3 = class(TForm) GroupBox1: TGroupBox; Edit1: TEdit; GroupBox2: TGroupBox; Button1: TButton; Edit2: TEdit; Edit3: TEdit; Button2: TButton; Button3: TButton; Edit4: TEdit; Button4: TButton; Button5: TButton; Label1: TLabel; Label2: TLabel; procedure FormCreate(Sender: TObject); private public end;
var Form3: TForm3;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm3.FormCreate(Sender: TObject); var pos1bind, pos2bind, pos3bind: Integer; begin pos1bind := pos('-', Form2.RenDatname); end;
end. |
Jetzt mein Problem, wenn ich das Programm ausführe kommt bei dieser anweisung pos1bind := pos('-', Form2.RenDatname); eine zugriffsverletzung. Aber warum??? Kann mir jemand helfen?? habe delphi 6.
Hoffe es kann mir jemand helfen!!!!
Gruss andi
Solange die Bombe tickt ist alles in Ordnung, erst wenn sie damit aufhört wird es problematisch...