我现在想在a窗体里清空b窗体里的多个edit.text,请问怎么办
有人告诉我这么做
with tabSheet2 do
begin
for i:=0 to tabSheet2.ComponentCount-1 do
begin
if tabSheet2.Components[i].ClassType=Tedit then
Tedit( tabSheet2.Components[i]).Clear;
end;
end;
可是
tabSheet2.Components[i].ClassType=Tedit//这个tedit不对,因为这个tedit在别的b的窗体里,在本身a窗体里没有edit,所以不对,请问怎么办
有人告诉我这么做
with tabSheet2 do
begin
for i:=0 to tabSheet2.ComponentCount-1 do
begin
if tabSheet2.Components[i].ClassType=Tedit then
Tedit( tabSheet2.Components[i]).Clear;
end;
end;
可是
tabSheet2.Components[i].ClassType=Tedit//这个tedit不对,因为这个tedit在别的b的窗体里,在本身a窗体里没有edit,所以不对,请问怎么办
解决方案 »
- ShellListView 选文文件时itemindex始终=-1
- 不通过外部参数,在类内部获得实例的问题
- 高手请进!如果实现动态添加edit控件及对实现移动其到界面指定的位置。
- 不用鼠标的坐标,如何得到任务栏图标的坐标(图标在屏幕上的位置[x,y])
- 不行啦,不行啦,哪有Install Shield 6.3的中文语言包下载啊?up有分
- 在Win2000用过PcAnyWhere的进来看看!
- [SQL Server]Divide by Zero error encountered????
- 在IDE代码编辑器中怎样快速知道引发某个处理过程的是哪个事件?
- “Enimage1 类没有找到”怎么弄
- 招人:会Delphi, 做数据库工作
- 请介绍一本Delphi开发Access的书
- Dll文件导入的问题
begin
if tabSheet2.Components[i is Tedit then
Tedit( tabSheet2.Components[i]).Clear;
end;
i: integer;
begin
for i := 0 to Form2.ControlCount - 1 do
if Form2.Controls[i] is TEdit then
TEdit(Form2.Controls[i]).Text := '';
end;
for I := 0 to lyybb.RzPanel3.ControlCount - 1 do
begin
if (lyybb.RzPanel3.Controls[I] is tRzEdit) then
(lyybb.RzPanel3.Controls[I] as tRzEdit).Text := '';
end;
错误如下:
[Error] main.pas(222): Undeclared identifier: 'tRzEdit'
var
i : integer;
begin
for i:=0 to b.ComponentCount-1 do
begin
if b.Components[i] is Tedit then
Tedit( b.Components[i]).Text := '';
end;
绝对可以的,已测试过!
Unit
StdCtrls
),然后在a的Uses中添加那个单元。例如TEdit是在StdCtrls中。
unit Unit1;interfaceuses
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
i: integer;
begin
for i := 0 to Form2.ControlCount - 1 do
if Form2.Controls[i] is TEdit then
TEdit(Form2.Controls[i]).Clear;
end;end.