Set Custom BackColor of Textbox

wakh

Well-known member
Joined
Oct 6, 2008
Messages
61
Programming Experience
3-5
Hi Guys,

I would like to know how to set the backcolor of a textbox to custom color through code (i.e. to colors other than the ones listed in color object) in Visual Basic 2008?. In Visual Basic 6 we use to supply hex value and it was done. I can confirm it can be done because the color dialog of backcolor property allows it.

Awaiting your helpful replies...

Best Regards,
wakh
 
It's very easy to learn this by setting a custom color in design mode and then looking at your designer.vb for the form. This is the decimal version.

Me.textBox1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(128, Byte), Integer))
 
Thanks BanditSteve. :)

I found a simpler way i.e. :

VB.NET:
TextBox1.BackColor = Color.FromArgb(255, 255, 234)
 
Back
Top