SOS of all SOS'es
-
:(I'm using this code to save the settings:
SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color)
I'm using this code to get the settingsdim a$ = getSetting("program", "programSettings", "bgcolor")
then I used this code to assign the settings back:me.textbox1.BackColor = new color(a)
:confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh: -
:(I'm using this code to save the settings:
SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color)
I'm using this code to get the settingsdim a$ = getSetting("program", "programSettings", "bgcolor")
then I used this code to assign the settings back:me.textbox1.BackColor = new color(a)
:confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh:NANCO wrote:
SaveSetting("program", "programSettings", "bgcolor", Text1.BackColor = ColorDialog1.Color)
This looks to me like it would save a boolean, the result of checking if textbox1.BackColor is the same value as ColorDialog1.Color. This is an artefact of VB being crap, sorry. Or, I am wrong, I could be. What happens when you step through the code ? Why do you have an assignment ( or equality check, how do you tell the difference in VB ? ), inside the Save code ? Surely your variables are not called Text1 and ColorDialog1, REALLY ???
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
NANCO wrote:
SaveSetting("program", "programSettings", "bgcolor", Text1.BackColor = ColorDialog1.Color)
This looks to me like it would save a boolean, the result of checking if textbox1.BackColor is the same value as ColorDialog1.Color. This is an artefact of VB being crap, sorry. Or, I am wrong, I could be. What happens when you step through the code ? Why do you have an assignment ( or equality check, how do you tell the difference in VB ? ), inside the Save code ? Surely your variables are not called Text1 and ColorDialog1, REALLY ???
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
:(I'm using this code to save the settings:
SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color)
I'm using this code to get the settingsdim a$ = getSetting("program", "programSettings", "bgcolor")
then I used this code to assign the settings back:me.textbox1.BackColor = new color(a)
:confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh:Hi there, The statement 'textbox1.BackColor = ColorDialog1.Color' generates a boolen value, not the value of the color code. Do it as follow: TextBox1.BackColor = ColorDialog1.Color ' Save to registry SaveSetting("program", "programSettings", "bgcolor", TextBox1.BackColor.ToArgb) ' Apply from registry Me.TextBox1.BackColor = Drawing.Color.FromArgb(GetSetting("program", "programSettings", "bgcolor")) Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
-
I don't know; I just got the code, it doesn't work. I will put it simply, can anyone tell me how to save and retrieve a BackColor, so I can assign it back on startup.:|
NANCO wrote:
I don't know; I just got the code, it doesn't work.
Getting code off the web is fine, so long as you're able to understand it. If you can't understand it, then you should stop and work through a book, so you know enough VB.NET that the web helps you with syntax, not with writing code. To store a color, you'd probably store the red, green and blue components as integers, then you'd use those to create a color again.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )