Groups | Blog | Home
all groups > vb.net controls > october 2004 >

vb.net controls : TextBox.BackColor - Set VS Check



[tridy]
10/19/2004 5:32:12 PM
Hello.

I am trying to check if the control's (textbox) background is red.
two lines -- first works, second does NOT.



1) txtFirstName.BackColor = System.Drawing.Color.Red
2) If txtFirstName.BackColor = System.Drawing.Color.Red Then ' blah blah
blah



it is possible to make it work by adding <.ToString>
---------------------------------------------------------------------------------------------
If txtFirstName.BackColor.ToString() = System.Drawing.Color.Red Then Exit
Sub.ToString() Then ' blah blah blah
---------------------------------------------------------------------------------------------

but I wonder why line 2 doesn't work :(




Thanks



Emmanuel Petit
10/19/2004 5:44:51 PM
You could try something like that :

if txtFirstName.BackColor.ToString = "Color [Red]" then 'blah, blah....



"[tridy]" <tridy[at]takas[dot]lt> a écrit dans le message de news:
Oj1VjietEHA.636@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Herfried K. Wagner [MVP]
10/19/2004 7:08:07 PM
"[tridy]" <tridy[at]takas[dot]lt> schrieb:
[quoted text, click to view]

\\\
If txtFirstName.BackColor.Equals(Color.Red) Then...
///

--
Herfried K. Wagner [MVP]
[tridy]
10/20/2004 10:23:11 AM
This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C4B68E.CE6540D0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

geeee, thanks.
I was stupid or something ;)


[quoted text, click to view]

\\\
If txtFirstName.BackColor.Equals(Color.Red) Then...
///

--=20
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
------=_NextPart_000_0013_01C4B68E.CE6540D0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV><FONT face=3DArial size=3D2>geeee, thanks.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I was stupid or something =
;)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Herfried K. Wagner [MVP]" &lt;<A=20
=
href=3D"mailto:hirf-spam-me-here@gmx.at">hirf-spam-me-here@gmx.at</A>&gt;=
wrote=20
in message <A=20
=
href=3D"news:%23oEg14ftEHA.3860@TK2MSFTNGP09.phx.gbl">news:%23oEg14ftEHA.=
3860@TK2MSFTNGP09.phx.gbl</A>...</DIV>"[tridy]"=20
&lt;tridy[at]takas[dot]lt&gt; schrieb:<BR>&gt; I am trying to check if =
the=20
control's (textbox) background is red.<BR>&gt; two lines -- first =
works,=20
second does NOT.<BR>&gt; <BR>&gt; 1) txtFirstName.BackColor =3D=20
System.Drawing.Color.Red<BR>&gt; 2) If txtFirstName.BackColor =3D=20
System.Drawing.Color.Red Then ' blah blah <BR>&gt;=20
blah<BR><BR><A>\\\</A><BR>If txtFirstName.BackColor.Equals(Color.Red)=20
Then...<BR>///<BR><BR>-- <BR>Herfried K. Wagner [MVP]<BR>&lt;<A=20
=
href=3D"http://dotnet.mvps.org/">URL:http://dotnet.mvps.org/</A>&gt;</BLO=
CKQUOTE></BODY></HTML>

------=_NextPart_000_0013_01C4B68E.CE6540D0--
AddThis Social Bookmark Button