Link to home
Start Free TrialLog in
Avatar of zattz
zattz

asked on

C# enumerate all open winforms

Hi

How can I get a reference to all the open forms in my application? I want to change their positions.

Thanks
Avatar of ashraf882
ashraf882
Flag of Bangladesh image

Create a base form and inherit other form from base form.
Other way, you can pass it through constructor of each form;
ASKER CERTIFIED SOLUTION
Avatar of sudheeshthegreat
sudheeshthegreat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
On any suitable event write below lines of code
FormCollection collections = Application.OpenForms;
foreach (Form f in collections)
{
  f.Location = new Point(10, 10); // set you location here
}

Open in new window