注册 登录
编程论坛 Delphi论坛

请教一个SAVEDIALOG控件的问题

toylie 发布于 2005-08-15 10:56, 1231 次点击

做一个文本编辑器当我新建一个文本的时候却无法将新文本保存 我的保存语法是这样的: procedure TForm1.S1Click(Sender: TObject); begin if fn=' 'then begin savedialog1.Execute

fn:=savedialog1.FileName; richedit1.Lines.SaveToFile(fn); end; if fn<>' ' then

richedit1.Lines.SaveToFile(fn); end;

end. 当我按下保存后,系统给出的提示是: project project2.exe raised exception class EFCreateError with message '无法创建文件' process stopped Use Step or Run to continue -------------------------------------------------------------- 请大家赐教

2 回复
#2
toylie2005-08-15 11:25
但是我用上面的方法写另存为就可以
begin
if savedialog1.Execute then
begin
fn:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fn);
end;
 end;
难道是判断出错了吗?
#3
makebest2005-08-25 20:33
不要搞得太复杂了,这样就行
procedure TForm1.S1Click(Sender: TObject);
begin
if savedialog1.Execute then
begin
fn:=savedialog1.FileName;
richedit1.Lines.SaveToFile(fn);
end;
end.

[此贴子已经被作者于2005-8-25 20:34:14编辑过]


1