简体   繁体   English

加载文件然后保存而不保存对话框

[英]Load a file then save without save dialog

Stream scriptelfen;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if((scriptelfen = openFileDialog1.OpenFile())!= null)
                {
                string strfilename = openFileDialog1.FileName;
                string filetext = File.ReadAllText(strfilename);
                script_box.Text = filetext;

When I opened my file, it is displaying text or hex code extension. 当我打开文件时,它正在显示文本或十六进制代码扩展名。 I want to be able to push save file. 我希望能够推送保存文件。 I don't have to do a save file dialog is this possible at all ? 我不必执行保存文件对话框,这可能吗?

MSDN中的WriteAllText

File.WriteAllText("C:\file.txt", "your content.");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM