Create my own control

  • Thread starter Thread starter Rhonda
  • Start date Start date
R

Rhonda

I have a yes/no data field and would like to show that on
my form as a green/red circle, where "green" is "yes"
and "red" is "no".

Is there a way to create a control that associactes the
color to the control source value?

I know I can make code that sets the color of my circle
depending on the value - but I would like the control to
be like a "real" control - e.g. like the check box that
changes appearance (checked or not checked) based on the
value. If this works out I would like to make more
sophisticated controls that changes graphics based on the
control source value.
 
Rhonda,
I don't know of a way to do it with a circle, but you can do that with a
rectangle. Set the backcolor of the rectangle initially to red or green,
then use the click event to change it like this:

If Me.Box11.BackColor = vbGreen Then
Me.Box11.BackColor = vbRed
Else
Me.Box11.BackColor = vbGreen
End If

You can set the Special Effect property of the rectangle to sunken to give
it a nice effect.
 
Back
Top