3 Replies - 382 Views - Last Post: 21 February 2013 - 08:20 AM Rate Topic: -----

#1 msz_900  Icon User is offline

  • New D.I.C Head

Reputation: -5
  • View blog
  • Posts: 40
  • Joined: 09-February 11

how to save text file as their custom setting

Posted 20 February 2013 - 10:58 PM

hy guy's .... i have a programm as i discuss before like a notepad and iwan that when i save a text file and i set the font-size like =28 or something like that, now when anytime i open it again it will open with the same setting as i set,,, the problem is that it's not.

here is the save button code i have..


 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fnane = "";
            saveFileDialog1.FileName = "";
            saveFileDialog1.Filter = "Textfiles|*.txt|All files|*.*";
            foreach (Control rhh in tabControl1.SelectedTab.Controls)
            {
                if (rhh is RichTextBox)
                {
                    if (saveFileDialog1.ShowDialog()!= DialogResult.Cancel)
                    {

                        fnane = saveFileDialog1.FileName;
                        (rhh as RichTextBox).SaveFile(fnane, RichTextBoxStreamType.PlainText);

                    }
                }
            }



Is This A Good Question/Topic? 0
  • +

Replies To: how to save text file as their custom setting

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,199
  • Joined: 02-June 10

Re: how to save text file as their custom setting

Posted 21 February 2013 - 07:40 AM

The 'Challenges' area is not for code that has been a challenge for you personally. It is for challenges being offered up to the group, like a contest.
"Who can write a program to display 'Hello World' using a picture of a real world, in the least amount of code?" That sort of thing.

For questions that you need help with, please post in the regular C# section.

From my FAQ list:

Q: ... save data, save properties, save environmental variables, serialize my data/class?
A:

This post has been edited by tlhIn`toq: 21 February 2013 - 07:41 AM

Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,472
  • Joined: 05-May 12

Re: how to save text file as their custom setting

Posted 21 February 2013 - 08:07 AM

Instead of saving as plain text that contains no formatting, you'll want to save as rich text that retains the formatting information.
Was This Post Helpful? 1
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,199
  • Joined: 02-June 10

Re: how to save text file as their custom setting

Posted 21 February 2013 - 08:20 AM

I totally read the questions wrong. I saw 'settings' and thought the OP was talking about program settings: That the user had custom settings (Such as font size for the GUI making the interface easier to read) and wanting to restore that when the *program* was opened again, not format of the *document* was opened again. Good catch Skydiver.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1