用Tstringlist将文件内容读出来
combox1.items:=tstringliststxtfile_rowcount=tstringlist.items.conut ;
第三个太长了,是extract之类的
如果你设定了combobox1的dropstyle为只读下拉而非能读写的话,它是不会显示你所付给的值

解决方案 »

  1.   

    1、建立一COMBOBOX中的ITEMS的值,怎样能时其中的值是由外部文件所得到 
      即:外部文件a.txt的内容是 
          SELECT 1 
          SELECT 2 
          SELECT 3 
      DELPHI中的COMBOBOX的ITEM值由上面的TXT得到 
    // combobox.items.loadfrom(filename);
    2、怎样能统计一外部TXT文件的行数 
      //line:=0;
      // while Eoln(F) do
      // begin
      //  line:=line+1; 
      // readln(f);
      // end;
    3、用OPENDIALOG打开一文件,怎样判断此文件的后缀是什么 
       //ExtractFileExt(F)
    4、以下语句有什么错误,运行程序没提示错误,但COMBOBOX不显示TEXT的值 
    // try it::
    {    if fileexist(c:\a.txt) then 
      begin 
        combobox1.items.clear;
        combobox1.items.add('ok');
        combobox1.itemindex:=0;
      end else begin
        combobox1.items.clear;
        combobox1.items.add('error');
        combobox1.itemindex:=0;
      end;
    }
        combobox1.text='error' 
      ....