How to change a listBox 'BackColor' during runtime ?


I have a .Net Form Application and need to toggle a listBox background color from red to green during run-time.  I realize the listBox property has this setting in the designer mode but that doesn't do me any good.

I'm guessing the syntax goes like this:

listBox1->BackColor =  some hex value

If there is a list of all available colors that would be even better, otherwise red and green are fine.

I did some reading on-line and saw something like the stuff below ... is all that necessary ?

virtual property Color BackColor {
    Color get () override;
    void set (Color value) override;
Who is Participating?
lakshman_ceConnect With a Mentor Commented:
You can set all these colors to the listbox

listBox1->BackColor = Color::Red;
John500Author Commented:
Thanks again !
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.