Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I have created a user Control which contains Show property can set to True or False and another property Color which Changes Color of my control. But I want that when user will use in Windows Application then user should be able to change these properties. How can I do this ???
 
public bool Draw1MinuteTicks
    {
        get { return this.bDraw1MinuteTicks; }
        set { this.bDraw1MinuteTicks = value; }
    }
public Color TicksColor
    {
        get { return this.ticksColor; }
        set { this.ticksColor = value; }
    }
 
I have these properties. when I run and Check my Control it works fine. I run my control and set the Draw1MinuteTicks property to False and stop debugging and is I run again then the Draw1MinuteTicks Property is set to True. So I want that when I run my control and change Draw1MinuteTicks property to False then next time when I run my Control, Draw1MinuteTicks Property should be false only. and the same way TicksColor property to save the coor selected and show the same again when the control will be run.
 
How to do this ??
Posted 14-Aug-12 2:52am
Ank_ush2.9K
Edited 14-Aug-12 3:56am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This is the beauty of app settings...
So your color etc should be assigned using App settings...
Suppose you have a setting called "CurrentColor"
var settings = YourAppNameSpace.Default;
string currentcolor = settings[CurrentColor];
     
somcontrol.BackColor = Color.FromName(currentcolor);
 
Also save settings as :
 
var settings = YourAppNameSpace.Default;
string currentcolor = "Blue";
settings["CurrentColor"] = currentcolor;
settings.Save();
  Permalink  
v3
Comments
Ank_ush at 14-Aug-12 8:18am
   
I didn't got ur code ....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Folllow this Code Pro Article

 
Thanks,
 
Kuthuparakkal
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Follow the Steps given in this link and the Problem is solved.
http://blog.csharphelper.com/2009/12/09/save-and-restore-settings-in-c.aspx?results=1#SurveyResultsChart[^]
 
It's Working.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 320
1 OriginalGriff 275
2 Sergey Alexandrovich Kryukov 187
3 Afzaal Ahmad Zeeshan 154
4 Peter Leow 115
0 OriginalGriff 7,510
1 DamithSL 5,494
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 15 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100