Page 1 of 1

Changing and saving the back colour

Posted: Sun Apr 29, 2012 5:05 am
by hortencio
I want change the back colour of my program in vb C# and sucha change must be saved and when i open it must show me the changed colour. How can i do so?

thanks

Re: Changing and saving the back colour

Posted: Sun Apr 29, 2012 9:56 am
by comathi
In this case, you could create a new setting by double-clicking your project name in the solution explorer, and then going the the 'Settings' tab.

When creating the new setting, make sure to give it a name, as well as change it's type to 'color'.

The rest can be done with code.
Code: Select all
'Save the current backcolor
My.Settings.SettingName = Me.BackColor
My.Settings.Save()
'Load the saves BackColor
Me.BackColor=My.Settings.SettingName
Make sure to replace 'SettingName' by the name you gave to your setting.

Re: Changing and saving the back colour

Posted: Sun Apr 29, 2012 10:38 am
by Filip
comathi wrote:
In this case, you could create a new setting by double-clicking your project name in the solution explorer, and then going the the 'Settings' tab.

When creating the new setting, make sure to give it a name, as well as change it's type to 'color'.

The rest can be done with code.
Code: Select all
'Save the current backcolor
My.Sertings.SettingName = Me.BackColor
My.Sertings.Save()
'Load the saves BackColor
Me.BackColor=My.Settings.SettingName
Make sure to replace 'SettingName' by the name you gave to your setting.
Code: Select all
'Save the current backcolor
My.SETTINGS.SettingName = Me.BackColor
My.SETTINGS.Save()
'Load the saves BackColor
Me.BackColor=My.Settings.SettingName

Re: Changing and saving the back colour

Posted: Sun Apr 29, 2012 10:57 am
by comathi
Ohh, sorry about that. I'm on my iPod, so typos are very easy to make :lol: