Home > Archive > Visual Basic Syntax > April 2005 > How do use an IF statement with Color
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How do use an IF statement with Color
|
|
|
| Greetings,
In .net, I can SET the BackColor of a textbox using syntax such as:
gMainForm.txtView.BackColor = System.Drawing.Color.Yellow
But if I try to determine whether the color of a control such as a
textbox is a particular color, I get a syntax error. In other words,
the above statement compiles and works fine, but the following
statement does not even compile:
If gMainForm.txtView.BackColor = System.Drawing.Color.Yellow Then
End If
I even tried using "IS" in place of the equal sign, but that also did
not work.
How do I determine whether the BackColor of a textbox is a particular
color?
TIA,
Rex
| |
| Rick Rothstein 2005-04-25, 4:01 pm |
| Almost everybody in this newsgroup is using VB6 or lower. While you may
get a stray answer to VB.NET (including VB2003 and VB2005 which has
dropped .NET from its name) questions here, you should ask them in
newsgroups devoted exclusively to .NET programming. Look for newsgroups
with either the word "dotnet" or "vsnet" in their name.
For the microsoft news server, try these newsgroups for Visual Basic
..NET related questions...
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data
And these for more general .NET questions
microsoft.public.dotnet.general
microsoft.public.vsnet.general
Note: There are many other .NET newgroups (use the first three "fields"
from the last two as templates when searching for them), but the above
ones should get you started.
Rick - MVP
"Rex" <rbasham@cfl.rr.com> wrote in message
news:dk4q619t2j7211laqfgh3j13718sl7vv27@
4ax.com...
> Greetings,
>
> In .net, I can SET the BackColor of a textbox using syntax such as:
> gMainForm.txtView.BackColor = System.Drawing.Color.Yellow
>
> But if I try to determine whether the color of a control such as a
> textbox is a particular color, I get a syntax error. In other words,
> the above statement compiles and works fine, but the following
> statement does not even compile:
>
> If gMainForm.txtView.BackColor = System.Drawing.Color.Yellow Then
>
> End If
>
> I even tried using "IS" in place of the equal sign, but that also did
> not work.
>
> How do I determine whether the BackColor of a textbox is a particular
> color?
>
> TIA,
> Rex
>
>
| |
| Bob Butler 2005-04-25, 4:01 pm |
| "Rex" <rbasham@cfl.rr.com> wrote in message
news:dk4q619t2j7211laqfgh3j13718sl7vv27@
4ax.com
> Greetings,
>
> In .net, I can SET the BackColor of a textbox using syntax such as:
--
<response type="generic" language="VB.Net">
This newsgroup is for users of Visual Basic version 6.0
and earlier and not the misleadingly named VB.Net
or VB 200x. Solutions, and often even the questions,
for one platform will be meaningless in the other.
When VB.Net was released Microsoft created new newsgroups
devoted to the new platform so that neither group of
developers need wade through the clutter of unrelated
topics. Look for newsgroups with the words "dotnet" or
"vsnet" in their name. For the msnews.microsoft.com news
server try these:
microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
</response>
| |
|
| Rick and Bob,
I had no idea of this!
I apologize, and thanks,
I will re-post elsewhere.
Rex
On Mon, 25 Apr 2005 12:00:03 -0400, "Rick Rothstein"
<rickNOSPAMnews@NOSPAMcomcast.net> wrote:
[color=darkred]
>Almost everybody in this newsgroup is using VB6 or lower. While you may
>get a stray answer to VB.NET (including VB2003 and VB2005 which has
>dropped .NET from its name) questions here, you should ask them in
>newsgroups devoted exclusively to .NET programming. Look for newsgroups
>with either the word "dotnet" or "vsnet" in their name.
>
>For the microsoft news server, try these newsgroups for Visual Basic
>.NET related questions...
>
> microsoft.public.dotnet.languages.vb
> microsoft.public.dotnet.languages.vb.upgrade
> microsoft.public.dotnet.languages.vb.controls
> microsoft.public.dotnet.languages.vb.data
>
>And these for more general .NET questions
>
> microsoft.public.dotnet.general
> microsoft.public.vsnet.general
>
>Note: There are many other .NET newgroups (use the first three "fields"
>from the last two as templates when searching for them), but the above
>ones should get you started.
>
>Rick - MVP
>
>
>
>"Rex" <rbasham@cfl.rr.com> wrote in message
> news:dk4q619t2j7211laqfgh3j13718sl7vv27@
4ax.com...
|
|
|
|
|