My.Settings question
-
I have a setting called bckColor which holds the color for the form I'm using. I want to be able to change that color (and save it) using another page. When the form loads, I use me.backcolor=my.settings.bckColor to set the form's backcolor up. The issue I am having is that the form doesn't always load the color from the My.Settings location. If I had red in the value, run the program and then stop it, manually change the value to blue and run it again, I get red as my backcolor. Am I missing any additional setting in the my.setting area? in the form properties?! Please help me. Thanks.
-
I have a setting called bckColor which holds the color for the form I'm using. I want to be able to change that color (and save it) using another page. When the form loads, I use me.backcolor=my.settings.bckColor to set the form's backcolor up. The issue I am having is that the form doesn't always load the color from the My.Settings location. If I had red in the value, run the program and then stop it, manually change the value to blue and run it again, I get red as my backcolor. Am I missing any additional setting in the my.setting area? in the form properties?! Please help me. Thanks.
Hi,
Me.BackColor = SomeOtherCode.BackColor
is always a bit tricky, because even if you are sure thatSomeOtherCode
is running when your form loads,SomeOtherCode.BackColor
may nevertheless not be in memory at that exact moment. Best is to passSomeOtherCode.BackColor
to a public variable when your application starts, then you can easily change the value of that variable on the fly (if necessary). ThenMe.BackColor = PublicVariableMyBackGroundColor
should work whenever your form loads. JohanMy advice is free, and you may get what you paid for.