如何在C#.net中使用SaveFileDialoge [英] How to use SaveFileDialoge in C#.net

查看:111
本文介绍了如何在C#.net中使用SaveFileDialoge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的你好.
我使用saveFileDialog来保存richtextbox的文本,保存按钮的代码:

 saveFileDialog1.ShowDialog();
richTextBox1.SaveFile(saveFileDialog1.FileName); 


这是我的问题:
1.在打开的窗口中设置路径和名称,没有默认的文件保存名称
2.当我打开保存的文件时,除了richbox.text
还有很多字符
请帮助me.im,它是C#上的新增功能,我需要更多解释. .如果要纯文本,请使用 SaveFile() [ SaveFileDialog [ * OpenFileDialogx [ http://msdn.microsoft.com/en-us/library/aa984409 (v = vs.71).aspx [ 2)现在您可以创建一个记事本以达到学习目的.参见此处示例
http://forum.codecall.net/topic/45330-a-simple-notepad -in-c/ [ ^ ]


Hello dears.
I used saveFileDialog to save a text of richtextbox, code of save button:

saveFileDialog1.ShowDialog();
richTextBox1.SaveFile(saveFileDialog1.FileName);


And this is my problem:
1.in opening window to set path and name, there is not default name for saving file
2.when i open the saved file there are a lot of characters more than richbox.text

please help me.im new on c# and i need more explain.

解决方案

You have saved the file as default type (RTF) so it will include all the control characters. If you want plain text then use the form of SaveFile()[^] that allows you to specifiy the type of the output stream.

NB: Adding lots of e''s to the word please will not got your question answered any faster; it just makes you look like a jerk.


Your answer is here:

SaveFileDialog[^]

*OpenFileDialogx[^]


see here for more details:

http://msdn.microsoft.com/en-us/library/aa984409(v=vs.71).aspx[^]

1)generally we will use savefile dialog box because of what ever we will write in textbox that will stores on where ever you want(required path).
2)now u can create a notepad to u r learning purpose . see here example
http://forum.codecall.net/topic/45330-a-simple-notepad-in-c/[^]


这篇关于如何在C#.net中使用SaveFileDialoge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆