簡體   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;

當我打開文件時,它正在顯示文本或十六進制代碼擴展名。 我希望能夠推送保存文件。 我不必執行保存文件對話框,這可能嗎?

MSDN中的WriteAllText

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM