改變FileListBox的路徑 |
答題得分者是:william
|
johnnychang
一般會員 發表:24 回覆:26 積分:16 註冊:2002-09-27 發送簡訊給我 |
我用下列方式來列出某一個目錄的檔案: 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 發送簡訊給我 |
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 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |