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

文件保存在指定文件夹下

尚未結案
zzmbeyond01
中階會員


發表:98
回覆:167
積分:53
註冊:2003-09-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-20 22:29:51 IP:218.70.xxx.xxx 未訂閱
各位大大: 我有一个程序在project文件夹下,还有一个专门放文本的文件夹TXT在project目录下:...project\TXT 我的程序要实现这样的功能: 先打开一个文本文件,录入数据后,然后自动让其保存在指定的文件夹TXT下, 请问如何实现呢? 谢谢!
ralph
初階會員


發表:41
回覆:82
積分:29
註冊:2003-02-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-21 00:09:38 IP:66.171.xxx.xxx 未訂閱
Before loading form, you should read your data from txt. And depending on you to how to save the data. You can save the data while the program finishs the process.
zzmbeyond01
中階會員


發表:98
回覆:167
積分:53
註冊:2003-09-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-02-21 00:47:43 IP:218.70.xxx.xxx 未訂閱
ralph 大大: 这个新文件还没有在TXT文件夹下创建呢。 要打开的(指定格式的)新文件客户是随机的,然后我想在程序中指定一个位置 如TXT文件夹下,把客户选择的新文件以txt格式保存下来。    顺便在问一个问题:  
procedure TForm1.Button1Click(Sender: TObject);
var
od:TOpendialog;
Memo:Tmemo;
begin
od:=TOpenDialog.create(self);
Memo:=TMemo.create(self);   <-为什么说没有指定memo的父窗体呢!
>    谢谢!     
        
ralph
初階會員


發表:41
回覆:82
積分:29
註冊:2003-02-04

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-02-21 02:48:40 IP:66.171.xxx.xxx 未訂閱
You define your format of TXT and the save like the following.....    procedure TForm1.Button1Click(Sender: TObject); begin   //If you want to save TXT into the default directory(c:\txt)   //If you did not create a TXT directory, it will show the window like "My Document "   SaveDialog1.InitialDir := 'c:\txt';   SaveDialog1.Filter := 'Text files (*.txt)|*.TXT';   SaveDialog1.Execute; end;    Memo:=TMemo.create(self); <-为什么说没有指定memo的父窗体呢! It is not this line error. The error is on "memo.lines.clear ;" You should add this line after "Memo:=TMemo.create(self);" memo.ParentWindow := form1.Handle; <== Add
zzmbeyond01
中階會員


發表:98
回覆:167
積分:53
註冊:2003-09-07

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-02-22 22:13:29 IP:219.153.xxx.xxx 未訂閱
谢谢! memo问题解决了!
ralph
初階會員


發表:41
回覆:82
積分:29
註冊:2003-02-04

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-02-23 22:45:25 IP:66.171.xxx.xxx 未訂閱
If you save the words from Memo, it will be easy. Memo1 := TMemo.Create(self); memo1.ParentWindow := form1.Handle; Memo1.Lines.Add('Test!'); Memo1.Lines.SaveToFile ('c:\test.txt'); Memo1.Destroy;
zzmbeyond01
中階會員


發表:98
回覆:167
積分:53
註冊:2003-09-07

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-02-24 12:27:06 IP:218.70.xxx.xxx 未訂閱
You are right!
zzmbeyond01
中階會員


發表:98
回覆:167
積分:53
註冊:2003-09-07

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-02-24 15:12:52 IP:218.70.xxx.xxx 未訂閱
那么我用LoadFromFile方法,也可以在运行期打开指定的文本文件了 發表人 - zzmbeyond01 於 2004/02/24 15:16:32
系統時間:2024-09-28 6:32:24
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!