我通过字符串,动态创建FORM,我USES了对应的窗体文件,注册了窗口类,但是在FINDCLASS的时候还报错,说未找到类TWjdEdit_Sears,不知道为啥
procedure TWjd_list.opendata(_nodeid:Integer;_khid:integer);
var
_res:Integer;
FindForm:TForm;
FindFormClass:TFormClass;
classname:string;//窗体类名
begin
classname:='WjdEdit_Sears';
FindForm:=Tform(classname);
FindFormClass:=TFormClass(FindClass('TWjdEdit_Sears'));//这句就报错
application.Createform(FindFormClass,FindForm);
_res:=findform.ShowModal;
if _res=6 then
begin
refreshbtn.Click;
end;
end;initialization
begin
RegisterClass(TWjdEdit_Sears);
end;
procedure TWjd_list.opendata(_nodeid:Integer;_khid:integer);
var
_res:Integer;
FindForm:TForm;
FindFormClass:TFormClass;
classname:string;//窗体类名
begin
classname:='WjdEdit_Sears';
FindForm:=Tform(classname);
FindFormClass:=TFormClass(FindClass('TWjdEdit_Sears'));//这句就报错
application.Createform(FindFormClass,FindForm);
_res:=findform.ShowModal;
if _res=6 then
begin
refreshbtn.Click;
end;
end;initialization
begin
RegisterClass(TWjdEdit_Sears);
end;
解决方案 »
- 请问大神们如何推敲规律?
- 我在delphi中用一个按钮触发把程序的状态栏的图标变为隐藏怎么把它再改回来
- delphi控制excel单元格的格式
- 如何取listview中的内容?
- VB里这段代码用delphi该怎么写?
- 求教如何在delphi7中使用JMAIL集群发信或介绍可以批量发信的组件!
- TlistBox里面有没有一个属性值可以储存各个item的隐含值?
- 再问:关于数据类型的转化!!!
- 怎样把一个ADO的数据库程序打包.我用的是DELPHI自带的打包程序.送100分!!!
- 最近遇到用webbrowser的问题。。。
- 在没有delphi的机子上运行dephi程序需要哪个dll文件?
- 急求,delphi7第三方控件,在线等
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
Form2Class:TClass;
Form2:TForm2;
begin
Form2Class:=FindClass('TForm2');
Form2:=TForm2(Form2Class.NewInstance);
Form2.Create(Self);
Form2.Show;
end;end.
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm2 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end; TForm2Class=class of TForm2;implementation{$R *.dfm}Initialization
RegisterClass(TForm2);finalization
UnRegisterClass(TForm2);end.
Visula属性设为False才行(经验总结).