VBOfficer Posted January 26, 2009 Posted January 26, 2009 Hi, I wanna save and load my color selected by ColorPicker like this: SaveSetting("MyApp", "Style", "Color", ColorPickerButton1.SelectedColor.ToString) ColorPickerButton1.SelectedColor = Color.FromName(GetSetting("MyApp", "Style", "Color")) The color I am loading from the settings does not get loaded correctly. Perhaps in converting or something else. Please help me :( Quote
Nate Bross Posted January 26, 2009 Posted January 26, 2009 The best way, is probably to use the Application Settings: (VB2008) http://visualbasic.about.com/od/usingvbnet/a/appsettings_3.htm IIRC, it works the same for VB2005 Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
VBOfficer Posted January 26, 2009 Author Posted January 26, 2009 Thank you for wrong advise! In this case, the problem is not with method of saving / loading data. The problem is that when I save the .SelectedColor of Color Picker control as String, and need to load it back, how can I really convert String to Color? The convert method I am using won't work!!! PS in my real application I am saving the data to a database...:( Quote
VBOfficer Posted January 27, 2009 Author Posted January 27, 2009 (edited) Help me please!:( Edited January 27, 2009 by VBOfficer Quote
Nate Bross Posted January 27, 2009 Posted January 27, 2009 I would load and store the value as an Argb integer, becuase it'll be much more space efficient. System.Drawing.Color c = new System.Drawing.Color() c = System.Drawing.Color.White Save("color", c.ToArgb()) System.Drawing.Color.FromArgb(Load("color")) PS, you are welcome for the wrong advice... Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Administrators PlausiblyDamp Posted January 27, 2009 Administrators Posted January 27, 2009 What exactly is the problem? Is the colour changing between a load and save? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.