I want to convert the string Form name to Winform Object to show the form.In project the string form name is getting from database header table and its constructor is get from its detail table.
Here is the table structure
*HEADER TABLE*
ID,Name
*DETAIL TABLE*
ID,Constructor_Name,Constructor_Value
Generally. the DB and UI are at such opposite ends that I would recommend don’t store the actual winform name, but store some string token / enumeration instead, and just use a switch:
in all seriousness, the above is not usually much of a maintenance overhead, and the static typing makes it hard to get much wrong. And it will still work when you refactor or switch to a different UI implementation.
However, you can use reflection. If you have an assembly-qualified name, then:
otherwise, if just namespace-qualified, you should ideally obtain the
Assemblyfirst:Then simply: