samedi 28 mars 2015

C# winforms cast childform as of it's own type

I have MDI project. I'm using Form activeForm = this.ActiveMdiChild;


However, Instead of Form I'm for something like


Forms.Lookup.Grade activeForm = (Forms.Lookup.Grade) this.ActiveMdiChild; Forms.Lookup.Product activeForm = (Forms.Lookup.Product) this.ActiveMdiChild; ...etc so if Forms.Lookup.Grade is active I want return activeForm as Forms.Lookup.Grade


How can I cast active form as of it's own type in generic way instead of using Switch this.ActiveMdiChild.Name ?


Thank You Mansi


Aucun commentaire:

Enregistrer un commentaire