destructor TXComboBox.Destroy;
var
    i, vcount: integer;
    RegFile: TIniFile;
    SectName, tmp: string;
begin
    if not (csDesigning in ComponentState) then
    begin
        if Owner is TWinControl then
        begin
            try
            SectName := (Owner as TWinControl).Name + 'List';
            RegFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));    //以上都没有错,就下面这句出错!!--说是没有父窗口?
            vcount := self.Items.Count;  //出错
            for i := 0 to vcount - 1 do
            begin
                tmp := Items[i];
                RegFile.WriteString(sectName, IntToStr(i), tmp);
            end;
            RegFile.Free;
            except
            end;
        end;
    end;
    inherited;
end;

解决方案 »

  1.   

    出什么错???
    不用selef试试
    直接items.count
      

  2.   

    你直接等于FCount看成不成。----------------
    沉沦中..........
      

  3.   

    to ihihonline(小小->沉沦中..........) : TComboBox这个类根本就没有Fcount属性呀to   liuhelin(鹤林) 和lovelymelon(小人物) : 应该不是self的问题,因为我在Create事件中用self就可以.to  zhboy(孔方兄) ( ): 那应该怎么办??
      

  4.   

    to 小小:没有用吧, TComboBox->TCustomComboBox -> TWinControl 都没有!那以上就不可能了.
      

  5.   

    编译没有问题的,只是运行时提示'Control 'XComboBox1' has no parent window'.