C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Reflection


Posted Date: 03 Nov 2009      Posted By: Chandan      Member Level: Gold     Points: 1   Responses: 2




Hi,

I have a requirement to list out all available Win Form in a perticular dll/exe and need to bind to a dropdown box. so that by selecting menu from dropdown user can invoke that particular form.

Please help me to acheive this requirement.

Best Regards,
Chandan Gupta





Responses

Author: Abhisek Panda    03 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

You can just add the name of the forms in the list box and when the user selects a form and click on OK use if clause to invoke the particular form. In the if create constructor of the form and invoke ShowDialog method to call the form.

Thanks And Regards,
Abhisek Panda
Be Happy And Make Others Happy.
Go Green and Save Your Future.



Author: Anuraj    03 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Try this


Assembly asm = Assembly.GetExecutingAssembly();
Type[] types = asm.GetTypes();
foreach(Type t in types)
{
if (t.IsSubclassOf(typeof(System.Windows.Forms.Form)))
{
this.DropDownList1.Items.Add(t.Name);
}
}


Thanks
Anuraj
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.
dotnetthoghts



Post Reply
You must Sign In to post a response.
Next : View Image in Crystal Report
Previous : How to open new page in dot net
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use