Advertisement
Guest User

Untitled

a guest
May 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. LOADING ASSETS FROM REFERENCED PROJECTS DYNAMICALLY
  2.  
  3. If you have other projects loaded in your project.
  4.  
  5. For example, you have a winforms application and you reference other winform projects which deal
  6. with specific sections of your site.
  7.  
  8. These sections are accessible through a single menu, in our example a listview.
  9.  
  10. We can load a particular form from one of these projects depending on
  11. the user's selection during run-time.
  12.  
  13. The listview has two columns, represented by "|", the second is hidden.
  14.  
  15. FIGURE 1 - Form ADMINISTRATION
  16. |----------------------------------------------------------|
  17. | ADMINSTATION |
  18. |----------------------------------------------------------|
  19. | |
  20. | |Listview |
  21. | ---------------------------------- |
  22. | |Add Users | UserForms| |
  23. | |Delete Users | UserForms| |
  24. | |Manage Users | UserForms| |
  25. | |Add Invoice | FinanceForms| |
  26. | |Manage Payrolls | FinanceForms| |
  27. | |Order Stock | UserForms| |
  28. | |Delete Stock | UserForms| |
  29. | |Manage Users | UserForms| |
  30. | |
  31. ------------------------------------------------------------
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. You can handle the click event with the following function.
  39.  
  40.  
  41. Private Sub lvwUtilisateurs_Selection(ByVal eventSender As System.Object, ByVal e As EventArgs)
  42.  
  43. String form =
  44.  
  45. string dllName = "UserForms";
  46. var loadedClassFromDll = Assembly.Load(dllName).CreateInstance(strObjTmp);
  47.  
  48. loadedClassFromDll.Show();
  49.  
  50.  
  51. Dim nspc As String = strObjTmp.Substring(0, strObjTmp.LastIndexOf("."c))
  52. Dim o As Object = Nothing
  53.  
  54. clsObjet = Assembly.Load(nspc).CreateInstance(strObjTmp)
  55. clsObjet.frmFenMDI = FMdiBal
  56.  
  57. strTable = lvwMenu.clsSubItems("FctCod").Text
  58.  
  59. Select Case strTypeFonction
  60. Case "Consultation"
  61. clsObjet.Consulter(strTable)
  62. Case "Proposition"
  63. clsObjet.Saisir(strTable)
  64. Case "Hors Proposition"
  65. clsObjet.Saisir(strTable, strAcces)
  66. Case "Tables de référence"
  67. clsObjet.Table(strTable, strAcces)
  68. Case "Impression"
  69. clsObjet.Imprimer(strTable)
  70. End Select
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement