edit比较多,不可能逐一clear.是不是要拿ComponentCount来循环作clear?方法如何?
解决方案 »
- 想打印DBGrid,大家觉得哪种“打印控件”比较好?
- 指针的运用
- 三层结构中,当客户端数据更新回服务器后,客户端数据集CDSDetail.Refresh时出错?
- 如何做图形裁剪?就是指定只在一个 Rect 里做图,超出的就不显示了?
- 老婆生了個兒子,高興中。散分!順便求各位達人幫忙取個名字!
- 求救:如何用.net在IE中嵌入word界面???
- 急!!急!!急!!求教rave 报表问题(一天之内望有人 回复 )
- 关于Access的问题
- Delphi明明比vc好用,为什么还要用VC呢!!!郁闷
- 高手请进
- 如何用SQL语句来创建一个表中的id字段是自动编号的???
- ADOQuery 的动态查询语言,咋看不到参数呢?
begin
if (Components[i] is TEdit) then
(Components[i] as TEdit).Text:='';
if (Components[i] is TMemo) then
(Components[i] as TMemo).Lines.Clear;
end;
改成这样子吧.
With TabSheet1 Do
for i:=0 to ComponentCount-1 do
begin
if (Components[i] is TEdit) then
(Components[i] as TEdit).Text:='';
if (Components[i] is TMemo) then
(Components[i] as TMemo).Lines.Clear;
end;
for i:=0 to ComponentCount-1 do
begin
if (Components[i] is TEdit) then
(Components[i] as TEdit).Text:='';
end;
showmessage(inttostr(TabSheet1.ComponentCount));
竟然显示0!就是说找不出在他上面的Component,怎么解决?
for i:=0 to ControlCount-1 do
begin
if (Controls[i] is TEdit) then
(Controls[i] as TEdit).Text:='';
end;
With TabSheet1 Do
for i:=0 to ControlCount-1 do
begin
if (Controls[i] is TEdit) then
(Controls[i] as TEdit).Text:='';
end;
加多一点要求,TabSheet1放在PageControl1下面,如果有很多TabSheet,
怎么用With PageControl1 Do 批量做呢?
intCount,intTmp:integer;
begin
with PageControl1 do
begin
for intTmp:=0 to ControlCount-1 do
begin
if (Controls[intTmp] is TTabSheet) then
begin
with (Controls[intTmp] as TTabSheet) do
begin
for intCount:=0 to ControlCount-1 do
begin
if (Controls[intCount] is TEdit) then
(Controls[intCount] as TEdit).Clear;
end;
end;
end;
end;
end;
end;