user3363294
user3363294

Reputation: 47

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 ?

Upvotes: 0

Views: 93

Answers (1)

take
take

Reputation: 2222

WriteAllText in MSDN

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

Upvotes: 2

Related Questions