I have 12 buttons placed on a form simplye named as button1, button2, ...,button12. I want to change their properties in a loop. Is there any means of possibilities that I might reach their properties in such manner or somewhat alike in a single loop

if you placed the buttons on a form via designer view or even programmatically created and added it into the Controls collection, you can access them via the Controls collection. Or if you know the names of the buttons and it was in the format of:

At a first glance at the code I really think that you've got it. But unfortunately the code does not compile at all causing errors.Since I do not want to change the property of all objects (buttons in this case) I prefer the second code but while compilation this code gives a error saying that

hmmm interesting as I am able to compile and run it fine. I did notice however the 2 brackets () were missed out in the GetType part. The O in typeof was lowered, again its best if you look at the Intellisense and make sure that the case sensitivity/keyword matches

Thank you very much for your reply. This time the first code compiled and worked properly. The second was still giving error but solved the problem by casting the control to a Button, and now it is working fine. Thnak you very much. Now the code looks like: