List of forms in the project

3

I need a List<> of all Forms in the c # project, so when I start the exe insert all the Forms in the database.

    
asked by anonymous 26.06.2015 / 14:59

1 answer

2
Using reflection can get the name of all classes of type Form like this:

IEnumerable<string> formNames = from t in Assembly.GetExecutingAssembly().GetTypes()
                                where t.IsClass && 
                                      t.BaseType == typeof(System.Windows.Forms.Form)
                                select t.Name;

Adapted from here

    
26.06.2015 / 15:43