unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, StdCtrls;type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var
  StringList: TStrings;
  StringL:TStrings ;
begin  StringList := TStringList.Create;
  StringL := TStrings.Create ;
  try
    with StringList do begin
      Add('This example uses A string List.');
      Add('It is the easiest way to add strings');
      Add('to a combobox''s list of strings.');
      Add('Always remember TStrings.Create method');
      Add('is abstract; So use TStringList.Create');
      Add('method instead.');    end;
    with StringL do
    begin
        //Add('1234560');
//        Add('147258369');
      Add('to a combobox''s list of strings.');
      Add('Always remember TStrings.Create method');
    end;
    DBGrid1.Columns[0].PickList :=  StringList  ;
    with ComboBox1 do begin
      Width := 210;
      Items.Assign(StringList);
      ItemIndex := 0;
    end;
//    end;
  finally
    StringList.free;
    StringL.Free ;
  end;
end;
end.

解决方案 »

  1.   

    help解释为
    DescriptionEAbstractError is raised when an application tries to call an Object Pascal abstract method. It is also raised at design time when a component with an Object Pascal abstract method is placed on a form.Abstract methods are declared with the abstract directive and must be overridden in descendant classes before an instance object can be created.
      

  2.   

    DBGrid1.Columns[0].PickList :=  StringList  ;
        with ComboBox1 do begin
          Width := 210;
          Items.Assign(StringList);
          ItemIndex := 0;
        end;
    //    end;
    FORM CREATE的时候放在FORM上 VCL都还没创建呢;
      

  3.   

    Abstract methods are declared with the abstract directive and must be overridden in descendant classes before an instance object can be created!
      

  4.   

    谢谢楼上两位
    但是我只要把
      with StringL do
        begin
            //Add('1234560');
    //        Add('147258369');
          Add('to a combobox''s list of strings.');
          Add('Always remember TStrings.Create method');
        end;
    屏蔽掉,就不会出错,但dbgrid1.column出不来
      

  5.   

    StringL := TStringList.Create ;./////
    StringL := TStrings.Create ;
      

  6.   

    to outer2000(天外流星) :为什么这样做呢
      

  7.   

    to outer2000(天外流星): Tstringlist是Tstring的 descendent class ,声明的是Tstrings,
    为什么却用的是Tstringlist.create.
      

  8.   

    TSTRINGS是ABSTRACT的, 不能CREATE;