線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2155
推到 Plurk!
推到 Facebook!

改變FileListBox的路徑

答題得分者是:william
johnnychang
一般會員


發表:24
回覆:26
積分:16
註冊:2002-09-27

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-01-17 14:18:09 IP:61.59.xxx.xxx 未訂閱
我用下列方式來列出某一個目錄的檔案:    procedure TOpenFile.ListFileName(); var   FileList: TFileListBox;   iIndex: integer; begin   FileList:=TFileListBox.Create(Application);   FileList.Directory:='E:\test\proj\all\';   For iIndex:=0 to FileList.Items.Count -1 Do     ..... end;    但到    FileList.Directory:='E:\test\proj\all\'; 時都會產生exception:    Project Test.exe raised exception class EInvalidOperation with message 'Control " has no parent windows'. .....     請問應該如何做才對? 謝謝.
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-01-17 14:28:18 IP:147.8.xxx.xxx 未訂閱
FileList is a window control..... btw, using FindFirst,FindNext,FindClose should be a better way... Try searching for it in this forum  <>< face="Verdana, Arial, Helvetica">引言: 我用下列方式來列出某一個目錄的檔案: procedure TOpenFile.ListFileName(); var FileList: TFileListBox; iIndex: integer; begin FileList:=TFileListBox.Create(Application); FileList.Parent := self; {if self is not a form/control... replace with any form/control} FileList.Visible := False; FileList.Directory:='E:\test\proj\all\'; For iIndex:=0 to FileList.Items.Count -1 Do ..... end; 但到 FileList.Directory:='E:\test\proj\all\'; 時都會產生exception: Project Test.exe raised exception class EInvalidOperation with message 'Control " has no parent windows'. ..... 請問應該如何做才對? 謝謝. < face="Verdana, Arial, Helvetica">
johnnychang
一般會員


發表:24
回覆:26
積分:16
註冊:2002-09-27

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-01-17 15:55:09 IP:61.59.xxx.xxx 未訂閱
原來如此! 現在可以了, 謝謝william.< >< >
系統時間:2024-04-20 15:59:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!