Instantiating windows form at runtime from database name C#
<p>I am having trouble instantiating a form in c# whose name i retrieve from a database, i have eliminated namespaces completely just to be sure i am not getting the object name wrong but still every time the code runs, the object returns as null instead of being the appropriate form. Please help urgently...</p>

<pre><code>private static Object CreateObjectInstance(string strObjectName)
{
    Object obj = null; // Temporary object

    try
    {
        if (strObjectName.LastIndexOf(".") == -1) // If there is no '.' in the object name
            strObjectName = Assembly.GetEntryAssembly().GetName().Name + "." + strObjectName;

        obj = Assembly.GetEntryAssembly().CreateInstance(strObjectName);
    }
    catch (Exception ex)
    {
        clsAdmFunctions.RecordException(ex); // Record error to the database
        MessageBox.Show("Error instantiating the object\n\nDescription : "+ex.Message, "Object Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        obj = null;
    }

    return obj;
}

public static Form CreateForm(string strFormName)
{
    return (Form)CreateObjectInstance(strFormName);
}
</code></pre>
