Solved

c# setting.settings

Posted on 2006-11-24
4
938 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now