JDYoder Posted December 17, 2003 Posted December 17, 2003 In VB6, ForeColor could translate into a single numeric value, which I then saved into my DB. With VB.Net, I still need to save ForeColor, however, I can't cast a Color to a number or vice versa. Is my only option to save the individual R, G, and B values of a control's .ForeColor property? Quote
JDYoder Posted December 17, 2003 Author Posted December 17, 2003 P.S. I can't even figure out how to change a forecolor's label to any other color thru code. Does anyone know how? Quote
Administrators PlausiblyDamp Posted December 17, 2003 Administrators Posted December 17, 2003 label1.ForeColor.ToArgb() will return an integer - should do the trick. to get a colour back from this integer you could do label1.ForeColor= System.Drawing.Color.FromArgb(integer here) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
JDYoder Posted December 17, 2003 Author Posted December 17, 2003 I was close. I had ToArgb worked out, but for the other I had... Label1.ForeColor.FromArgb(#) ... which I thought should work. But I see now that FromArgb simply returns a value and does not alter the object, which is why it should be as you posted with... Label1.ForeColor = System.Drawing.Color.FromArgb(#) Thanks. :) Quote
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.