当前位置:编程学习 > Delphi >>

delphi7.程序运行问题

我在form3窗体上只放了一个按钮,希望实现的功能是,按时打开form4窗体,同时关闭form3窗体,程序如下,,为何运行时,按按钮时直接就退出了呢?? unit Unit3; inte易做图ce uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm3 = class(TForm) Image1: TImage; Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form3: TForm3; implementation uses Unit4; {$R *.dfm} procedure TForm3.Button1Click(Sender: TObject); begin form4.show; form3.Close; end; end.
追问:
能注释下吗?开不懂啊!“self.close;”能把from3关闭?
如果form4不存在就创建一个,再显示,
self.close就是关闭自己的窗体
补充,原来的程序运行状况:运行时,按按钮时直接就退出了 或者过一段时间form4自动显示且form3不会关闭!把您给的程序替换form4.show;  form3.Close; 出现错误:[Error] Unit3.pas(34): Undeclared identifier: 'from4'  [Error] Unit3.pas(34): Incompatible types: 'TForm4' and 'TForm'  [Error] Unit3.pas(15): Unsatisfied forward or external declaration: 'TForm3.FormCreate'   [Fatal Error] .求详解,这段程序放哪?
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,