Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need to display list of opened forms name in list. how to do it...
Posted

try this:

C#
List<string> elements= new List<string>();
foreach (Form item in Application.OpenForms)
    elements.Add(item.Name  );
 
Share this answer
 
v2
Using Linq:
C#
//required
using System.Collections.Generic;
using System.Linq;

// somewhere in a method ...

List<string> OpenFormNameList = Application.OpenForms.Cast<Form>().Select(f => f.Name).ToList();

</string>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900