양식 10은 form11을 만들고 보여 주며 form11은 양식 12를 만들고 보여줍니다. 그런 다음 form12는 form10 (성공), form11 (액세스 위반) 제어 및 form12 (성공) 제어를 업데이트하려고 시도합니다. 중간 형식 인 form11을 업데이트하는 액세스 위반이 발생하는 이유는 무엇입니까? 논평 된 계산서 30와 31은 작동하지 않으며 나는 왜 지 알아야하는지 알고 싶다. 30은 중간 양식을 업데이트 중입니다. 31은 제쳐두고 관련이 없지만 작동하지 않아 왜 폭탄이 나는지 잘 모르겠습니다.어린이가 작동하지 않는 어린이 업데이트
1: unit Unit10;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, StdCtrls;
8:
9: type
10: TForm10 = class(TForm)
11: Button1: TButton;
12: procedure Button1Click(Sender: TObject);
13: private
14: { Private declarations }
15: public
16: { Public declarations }
17: end;
18:
19: var
20: Form10: TForm10;
21:
22: implementation
23: uses Unit11;
24:
25: {$R *.dfm}
26:
27: procedure TForm10.Button1Click(Sender: TObject);
28: var
29: fForm11 : TForm11;
30: begin
31: fForm11 := TForm11.Create(Application);
32: fForm11.show;
33: end;
34:
35: end.
1: unit Unit11;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, StdCtrls;
8:
9: type
10: TForm11 = class(TForm)
11: Button1: TButton;
12: procedure Button1Click(Sender: TObject);
13: private
14: { Private declarations }
15: public
16: { Public declarations }
17: end;
18:
19: var
20: Form11: TForm11;
21:
22: implementation
23: uses Unit12, Unit10;
24:
25: {$R *.dfm}
26:
27: procedure TForm11.Button1Click(Sender: TObject);
28: var
29: fForm12 : TForm12;
30: begin
31: form10.Button1.Caption := 'done';
32: fForm12 := TForm12.Create(Self);
33: fForm12.show;
34: end;
35:
36: end.
1: unit Unit12;
2:
3: interface
4:
5: uses
6: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7: Dialogs, StdCtrls;
8:
9: type
10: TForm12 = class(TForm)
11: Button1: TButton;
12: procedure Button1Click(Sender: TObject);
13: private
14: { Private declarations }
15: public
16: { Public declarations }
17: end;
18:
19: var
20: Form12: TForm12;
21:
22: implementation
23: uses Unit11, Unit10;
24:
25: {$R *.dfm}
26:
27: procedure TForm12.Button1Click(Sender: TObject);
28: begin
29: Form10.Button1.Caption := 'Unit10';
30: //Form11.Button1.Caption := 'Unit11'; //get an access violation
31: //Form12.Button1.Caption := 'Unit12'; //get an access violation
32: Button1.Caption := 'Unit12'; //this same as 31 without Form12 prefix
33: end;
34:
35: end.
초보자를위한 질문에 매우 만족하지만 답변을 읽고주의해야합니다. –