我加了个属性名称为'NumberName出',但一运行错信息如下:Property 'NumberName' doesn't exist in base class代码如下:
   type
  TForm1 = class(TForm)
    Button1: TButton;
  private
   FCount :Integer;
   function GetNumberName(index1 :Integer):String;
    { Private declarations }
  published
   property NumberName(index1 :Integer):String read GetNumberName;
  public
    { Public declarations }
  end;

解决方案 »

  1.   

    property NumberName(index1 :Integer):String read GetNumberName;
    改成,
     property NumberName: String read GetNumberName;
    属性你可以把它当成一个变量,而不要当成一个函数。
      

  2.   

    如果你的属性要带参数的话,就要用[]不能用()。而且不能放在published字段内。  TForm1 = class(TForm)
      private
       function GetNumberName(index1 :Integer):String;
        { Private declarations }
      public
       property NumberName[index1 :Integer]:String read GetNumberName;
       { Public declarations }
      end;function TForm1.GetNumberName(index1: Integer): String;
    begin
      result:=IntToStr(index1);
    end;