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

讀取檔案至StringGrid

 
riverlan
一般會員


發表:7
回覆:10
積分:5
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-03-15 11:51:12 IP:163.28.xxx.xxx 未訂閱
If I hva a txt file: 1 2 3 2 3 4 3 12 11 4 5 7 5 8 9 I want load in StringGrid Because StringGrid is a n*n metrix, So I can use it to record my any cities distance, So I use next describe to code, but is wrong StringGrid.TStringGrid.LoadFromFile('test.txt'); please help. Thanks, River
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-03-15 12:33:55 IP:192.168.xxx.xxx 未訂閱
引言: If I hva a txt file: 1 2 3 2 3 4 3 12 11 4 5 7 5 8 9 I want load in StringGrid Because StringGrid is a n*n metrix, So I can use it to record my any cities distance, So I use next describe to code, but is wrong StringGrid.TStringGrid.LoadFromFile('test.txt'); please help. Thanks, River
StringGrid未提供LoadFromFile的指令 您可能要自己讀檔拆欄位一個一個寫入,練習一下吧! AssignFile(F, OpenDialog1.FileName); Reset(F); Readln(F, S);{ Read the first line out of the file } CloseFile(F); StringGrid.cells[1,1]:=s1; StringGrid.cells[1,2]:=s2; StringGrid.cells[1,3]:=s3; ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
系統時間:2024-05-08 12:12:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!