Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: dynamically loading a winform based on a string

$
0
0

The following works for me when the Winforms app is in the same folder as the calling cs program:

        static void Main(string[] args)
        {
            Assembly MyCOB = Assembly.Load("WindowsFormsApplication1"); // DALL is name of my dll
            Type MyLoadClass = MyCOB.GetType("WindowsFormsApplication1.Form1"); // LoadClass is my class
            System.Windows.Forms.Form obj = (System.Windows.Forms.Form)Activator.CreateInstance(MyLoadClass);
            
            obj.ShowDialog();
        }
    }

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>