Solved

c# setting.settings

Posted on 2006-11-24
4
958 Views
Last Modified: 2008-01-09
I have enter a test value for color.

this is what I did.

 public Form1()
        {
            InitializeComponent();
            this.BackColor = Properties.Settings.Default.myColor;
        }


 private void button1_Click(object sender, EventArgs e)
        {
            colorDialog1.ShowDialog();
            Properties.Settings.Default.myColor = colorDialog1.Color;
            Properties.Settings.Default.Save();
        }

when I close the application and rerun it the color that was picked is correct. However when I look at the setting.settings the color still shows the default color which I pick at first which was blue.

I have 2 questions:
1. where does the setting for the new color get saved at?
I looked at the exe.config and I see the blue color that I picked in the setup of the application. I do not see the new color that is coming up.

2. what does the synchronize button do when pressed. Everything I press it I get a messagebox that states :

No user.config files were found in any of the following locations:

0
Comment
Question by:bman9111
  • 3
4 Comments
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 500 total points
ID: 18011296
this works for me, and persists the color when the app is shutdown and restarted

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            panel1.BackColor = Settings1.Default.MyColor;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ColorDialog nc = new ColorDialog();
            if (nc.ShowDialog() == DialogResult.OK)
            {
                this.button1.BackColor = nc.Color;
                Settings1.Default.MyColor = nc.Color;
                Settings1.Default.Save();
                panel1.BackColor = Settings1.Default.MyColor;
            }
        }
    }
0
 
LVL 8

Author Comment

by:bman9111
ID: 18014932
thank you, however I know how to set that. my question is these:

I have 2 questions:
1. where does the setting for the new color get saved at?
I looked at the exe.config and I see the blue color that I picked in the setup of the application. I do not see the new color that is coming up.

2. what does the synchronize button do when pressed. Everything I press it I get a messagebox that states :


I do appreciate the coding though.
0
 
LVL 8

Author Comment

by:bman9111
ID: 18088791
any ideas?
0
 
LVL 8

Author Comment

by:bman9111
ID: 18163478
u there?
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question