Open a UserControl's DLL RRS feed

  • Question

  • Hi,

    I created a Class Library and added a UserControl into it called employee_report.

    I now need to call the DLL file dynamically (not through VS Add Reference) and then display that userControl in my WinForm application.

    How can I do this please?



    Saturday, August 20, 2016 8:29 AM


  • Usually just "new"-ing the control as variable, then do <FormName>.Controls.Add() is good enough. If you don't want screen flickering you're advised to call <FormName>.SuspendLayout() before the call and then call <FormName>.SuspendLayout() after the control has been added. Because of how CreateWindow() sort of API works, you're recommanded to set the .Left, .Top, .Width, .Height and other basic visual layout related properties before you add the control to the form.
    Monday, August 22, 2016 1:39 AM