you can do this....just try to follow the steps below..
1. if your "mainform" is MDIForm or normal Windows Form...then
by invoking Application.OpenForms() method you able to find the name of ACTIVE FORM.
2. Next you want to do some actions with control available on that form, then
you need to use any looping technique (like FOR, Do While...) you can list the Controls on that form with their names by calling Controls() method to enumerate controls.
My Blog :