Skip to content

Instantly share code, notes, and snippets.

@Scribbio
Last active August 26, 2019 16:15
Show Gist options
  • Save Scribbio/f823a4e5bf397a0742143ba1d19640af to your computer and use it in GitHub Desktop.
Save Scribbio/f823a4e5bf397a0742143ba1d19640af to your computer and use it in GitHub Desktop.

Revisions

  1. Scribbio revised this gist Aug 26, 2019. 1 changed file with 11 additions and 17 deletions.
    28 changes: 11 additions & 17 deletions .txt
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,14 @@

    LOADING ASSETS FROM REFERENCED PROJECTS DYNAMICALLY

    If you have other projects loaded in your project.
    --CONTEXT-------------------------------------------------------------------------------------------------

    For example, you have a winforms application and you reference other winform projects which deal
    with specific sections of your site.
    with specific sections of your application.

    These sections are accessible through a single menu, in our example a listview.
    These sections are accessible through a single menu, in our example a listview (named LvAdministration)

    We can load a particular form from one of these projects depending on
    the user's selection during run-time.
    We can load a particular form from one of these projects depending on the user's selection during run-time.

    The listview has two columns, represented by "|", the second is hidden.

    @@ -31,25 +30,19 @@
    | |
    ------------------------------------------------------------





    --HOW TO DO IT-------------------------------------------------------------------------------------------------

    You can handle the click event with the following function.


    Private Sub lvwUtilisateurs_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)

    String form =
    Handle the listview's click event.

    Private Sub LvAdministation_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)

    string dllName = "UserForms";
    var loadedClassFromDll = Assembly.Load(dllName).CreateInstance(strObjTmp);

    loadedClassFromDll.Show();


    Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
    Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
    Dim o As Object = Nothing

    clsObjet = Assembly.Load(nspc).CreateInstance(strObjTmp)
    @@ -69,6 +62,7 @@
    Case "Impression"
    clsObjet.Imprimer(strTable)
    End Select
    End Sub



  2. Scribbio revised this gist May 17, 2019. No changes.
  3. Scribbio revised this gist May 17, 2019. 2 changed files with 76 additions and 51 deletions.
    76 changes: 76 additions & 0 deletions .txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@

    LOADING ASSETS FROM REFERENCED PROJECTS DYNAMICALLY

    If you have other projects loaded in your project.

    For example, you have a winforms application and you reference other winform projects which deal
    with specific sections of your site.

    These sections are accessible through a single menu, in our example a listview.

    We can load a particular form from one of these projects depending on
    the user's selection during run-time.

    The listview has two columns, represented by "|", the second is hidden.

    FIGURE 1 - Form ADMINISTRATION
    |----------------------------------------------------------|
    | ADMINSTATION |
    |----------------------------------------------------------|
    | |
    | |Listview |
    | ---------------------------------- |
    | |Add Users | UserForms| |
    | |Delete Users | UserForms| |
    | |Manage Users | UserForms| |
    | |Add Invoice | FinanceForms| |
    | |Manage Payrolls | FinanceForms| |
    | |Order Stock | UserForms| |
    | |Delete Stock | UserForms| |
    | |Manage Users | UserForms| |
    | |
    ------------------------------------------------------------






    You can handle the click event with the following function.


    Private Sub lvwUtilisateurs_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)

    String form =

    string dllName = "UserForms";
    var loadedClassFromDll = Assembly.Load(dllName).CreateInstance(strObjTmp);

    loadedClassFromDll.Show();


    Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
    Dim o As Object = Nothing

    clsObjet = Assembly.Load(nspc).CreateInstance(strObjTmp)
    clsObjet.frmFenMDI = FMdiBal

    strTable = lvwMenu.clsSubItems("FctCod").Text

    Select Case strTypeFonction
    Case "Consultation"
    clsObjet.Consulter(strTable)
    Case "Proposition"
    clsObjet.Saisir(strTable)
    Case "Hors Proposition"
    clsObjet.Saisir(strTable, strAcces)
    Case "Tables de référence"
    clsObjet.Table(strTable, strAcces)
    Case "Impression"
    clsObjet.Imprimer(strTable)
    End Select





    51 changes: 0 additions & 51 deletions .vb
    Original file line number Diff line number Diff line change
    @@ -1,51 +0,0 @@


    For example, if you have a dll of name "UserForms" referenced in your project it can load it dynamically


    And you have a menu which contains a list of sections , the user clicks on a item and it will load the required form from
    the required dll.

    USERFORMS
    ManageUsers | UserForms
    ------


    You can handle the click event with the following function.


    Private Sub lvwUtilisateurs_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)

    String form =

    string dllName = "UserForms";
    var loadedClassFromDll = Assembly.Load(dllName).CreateInstance(strObjTmp);

    loadedClassFromDll.Show();


    Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
    Dim o As Object = Nothing

    clsObjet = Assembly.Load(nspc).CreateInstance(strObjTmp)
    clsObjet.frmFenMDI = FMdiBal

    strTable = lvwMenu.clsSubItems("FctCod").Text

    Select Case strTypeFonction
    Case "Consultation"
    clsObjet.Consulter(strTable)
    Case "Proposition"
    clsObjet.Saisir(strTable)
    Case "Hors Proposition"
    clsObjet.Saisir(strTable, strAcces)
    Case "Tables de référence"
    clsObjet.Table(strTable, strAcces)
    Case "Impression"
    clsObjet.Imprimer(strTable)
    End Select





  4. Scribbio created this gist May 16, 2019.
    51 changes: 51 additions & 0 deletions .vb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@


    For example, if you have a dll of name "UserForms" referenced in your project it can load it dynamically


    And you have a menu which contains a list of sections , the user clicks on a item and it will load the required form from
    the required dll.

    USERFORMS
    ManageUsers | UserForms
    ------


    You can handle the click event with the following function.


    Private Sub lvwUtilisateurs_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)

    String form =

    string dllName = "UserForms";
    var loadedClassFromDll = Assembly.Load(dllName).CreateInstance(strObjTmp);

    loadedClassFromDll.Show();


    Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
    Dim o As Object = Nothing

    clsObjet = Assembly.Load(nspc).CreateInstance(strObjTmp)
    clsObjet.frmFenMDI = FMdiBal

    strTable = lvwMenu.clsSubItems("FctCod").Text

    Select Case strTypeFonction
    Case "Consultation"
    clsObjet.Consulter(strTable)
    Case "Proposition"
    clsObjet.Saisir(strTable)
    Case "Hors Proposition"
    clsObjet.Saisir(strTable, strAcces)
    Case "Tables de référence"
    clsObjet.Table(strTable, strAcces)
    Case "Impression"
    clsObjet.Imprimer(strTable)
    End Select