Solved

c# setting.settings

Posted on 2006-11-24
4
972 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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