how to reference other forms in different projects

3 posts, 0 answers
  1. Roger
    Roger avatar
    22 posts
    Member since:
    Nov 2017

    Posted 02 Jan Link to this post

    Hi

    I have several projects in the same solution (i.e clients, files, etc) and there are forms in all the projects with a main form as mdi parent in the "Main" project.

    Now I'm having problems opening forms in other projects through the frmMain.formOpen procedure as I can't reference frmMain when frmMain is referencing frmClient (for example...otherwise I get cyclic referencing).

    I want to be able to click a link on frmClient (in Client Project) which is a mdi child of frmMain (in Main project)  and open an mdi child (in frmMain) of frmComments which is in the Client project as well.

    The Main project references the Client project so I can get a handle on the form in Client but now I can't get a handle on  the frmMain to run openform procedure on it to open the frmComment

     

    Any suggestions how I could approach this (interface, event??)

     

    Tried

    Activator.CreateInstance(GetNamespace(frmName), frmName) as RadForm but the error is Could not load type 'formName' from assembly

  2. Roger
    Roger avatar
    22 posts
    Member since:
    Nov 2017

    Posted 02 Jan Link to this post

    OK..got it.

    Have an public event from each form and raise it with the form required to be opened. 

    On the main form add a handler to the event from that form (because the main form can reference all forms in all projects) and point it to a local procedure that adds the form (passed in the event argument) as an mdi child.

    Works fine.

  3. Dimitar
    Admin
    Dimitar avatar
    2486 posts

    Posted 03 Jan Link to this post

    Hello Roger,

    This approach is ok and there is no reason not to use it.

    In general, I would recommend you to use one project for the entire UI and put all forms in it. 

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top