# Visual Basic If,Then question

## Recommended Posts

Is it possible to make a variable with a specific color? For example can u make a If,Then statement like this. If "Color" = Blue Then set "Click" = true "Color" and "Click" are variables. Is it possible to do this and is there a tool to get the color?

##### Share on other sites
I'm not exactly sure how this works in Visual Basic, but I imagine that you use some kind of hexadecimal notation for colors.

Example:

Red = 0xffff0000
Blue = 0xff0000ff
Green = 0xff00ff00
Black = 0xff000000
White = 0xffffffff

In this way, a four-byte value such as an int can store colors.

##### Share on other sites
Hmm ill see if I can put that into code. Thanks!

If there are any other ways please tell me.

##### Share on other sites
Hmm ill see if I can put that into code. Thanks!

If there are any other ways please tell me.

##### Share on other sites
It's been over a year since I last used VB.NET, so this is from memory. You probably want something like this:
Dim myColour as ColorDim wasClicked as BooleanIf myColor = Color.Blue Then  wasClicked = TrueEnd If
Syntax and whatnot might not be right.

##### Share on other sites
Hmm lemme try that thanks!!!

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627653
• Total Posts
2978433

• 10
• 12
• 22
• 13
• 33