Try the following:
CommandButton1.BackColor = pbBlack
The problem with your current code is that the button is not actually selected when you click on it.
Thanks John , for the reply. . Im trying to change the backgroundColour of a selected symbol how do i do that?
2 of 2 people found this helpful
Ah, sorry, I interpreted your original post as wanting to change the background colour of the button you were clicking.
Out of curiosity, what is the symbol type that you are trying to modify? Not all symbols on a display are necessarily scriptable by default (especially those 'static' symbols that can be added to the display). If it is one of these symbols, you will need to explicitly enable scripting on it. To do so, switch to Build mode, and right mouse click the target symbol to bring up the following context menu:
Click the 'Enable Scripting' item and then you should be good to go.
Now, depending on the symbol type, what you want to change may possibly be the FillColor property, not necessarily the BackgroundColor. This is especially true for static symbols such as Rectangles, Ellipses, and other filled polygons.