Quantcast
Viewing all articles
Browse latest Browse all 18858

How to assign color for a bunch of buttons programatically

I got a grid of 5*5 with buttons (25 in total). I want to programatically assign background color for these and I want to know if there a way to do this instead of assigning one at a time like this:

btn1.Background = Color.Red;
btn2.Background = Color.Blue;
btn3.Background = Color.Green;
etc...

Can I somehow use a loop? 




Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>