两个components不一样
第一个是TForm.Components
指form上的组件
第二个是TApplication.Components
指整个Application的组件!
快给分!

解决方案 »

  1.   

    To liuxiaowei(巍巍):
    请再说清楚点。只有一个窗体的application.components和form.components有区别吗?
      

  2.   

    application.components包含Form
    form.components不包含Form本身
    你改的是Form的components,用application的话这样写:
    if application.components[i] is TForm then
    begin
      if application.components[i] as TForm).Components[j] is TEdit
      then
      begin
        (application.components[i] as TForm).Components[j] as TEdit).Caption := 'Text;'
      end
    end;
      

  3.   

    application.components包含Form
    form.components不包含Form本身
    你改的是Form的components,用application的话这样写:
    if application.components[i] is TForm then
    begin
      if (application.components[i] as TForm).Components[j] is TEdit
      then
      begin
        ((application.components[i] as TForm).Components[j] as TEdit).Caption := 'Text;'
      end
    end;
      

  4.   

    application中是不包含Label的,
    它只包含了Form,而Label 是包含在Form中的,所以
    TForm.Components[I] 才可能找到Label,Text呵呵,liuxiaowei(巍巍) ( 已讲得很清楚了