0

i have one list box in which i have shown all the names of the forms in my project using the following code:

    private void PopulateForms()
    {
        List<_class.AppForm> list = new List<_class.AppForm>();
        Type formType = typeof(Form);
        foreach (Type t in Assembly.GetExecutingAssembly().GetTypes())
        {
            if (formType.IsAssignableFrom(t))
                list.Add(new _class.AppForm() { id = t.FullName, FormName =    t.Name });
        }

        //add form name to to lst_Form
        lst_Foms.DataSource = list;
        lst_Foms.ValueMember = "id";
        lst_Foms.DisplayMember = "FormName";
    }

my question is that i want to show the controls of each form in another listbox by selecting each form in listbox1. can some body guide how to acheive that? thanks.

  • I wonder, why does one use winforms in 2017? There is WPF. – Sv Sv Jul 16 '17 at 14:24
  • i am sorry i started my project in 2016 – Iqbal Shah Jul 16 '17 at 14:34
  • @SvSv - WPF is unnecessarily complex (though powerful) and honestly, I have lost track of its future - is it dead? Probably, but who knows... I wouldn't advise newbies to waste time with WPF surely when you have WinForms which is simpler and more mature (more documentation). – FortyTwo Jul 16 '17 at 15:27
  • @IqbalShah - [How can I get all controls from a Form Including controls in any container?](https://stackoverflow.com/questions/1558127/how-can-i-get-all-controls-from-a-form-including-controls-in-any-container) – FortyTwo Jul 16 '17 at 15:30

0 Answers0