Changing and saving the back colour

Post your questions regarding programming in C# in here.
4 posts Page 1 of 1
Contributors
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

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
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

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.
Last edited by comathi on Sun Apr 29, 2012 10:54 am, edited 1 time in total.
Filip
Coding Guru
Coding Guru
Posts: 833
Joined: Wed Jan 05, 2011 3:59 pm

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
CodenStuff wrote:
Nope, it's just your sick and dirty mind. You sick twisted warped little pervo :D
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Ohh, sorry about that. I'm on my iPod, so typos are very easy to make :lol:
4 posts Page 1 of 1
Return to “General coding help”