Write Your First Visual Basic Program
Setting the BackColor
You can set the BackColor property at run-time in 2
ways.Way 1: Using the Color's
Every color has numeric value.
You can simply assign
this value to the BackColor property.
For example, The numeric value of
the red color is &H000000FF&
If you want to set the Form BackColor
property to red,
use the following code:Command1.BackColor =
You can find what is the numeric value of
color by making the following simple steps:
Click on the
BackColor property arrow button
in the properties window (Figure 10)
Then click on the Palette Tab (Figure 11).
Select your desirable color (Figure 12).
The color value will be displayed in the BackColor Property
cell (Figure 13).
And once again, if you setting a
Command Button's color,
don't forget to set its Style property to 1 -
To learn the second way, you'll have to learn
bit about Constants.
All of this in the next page...