1
我在vb.net 2008項目中使用下面的代碼動態加載dll的(與表單)從一個文件夾中,所有的偉大的作品,但我無法弄清楚的生活我如何調用一個函數或從插件獲取一個公共變量。vb.net動態插件加載問題
任何人都可以回答這個問題嗎?
Dim PluginList As String() = Directory.GetFiles(appDir, "*.dll")
For Each Plugin As String In PluginList
Dim Asm As Assembly
Dim SysTypes As System.Type
Asm = Assembly.LoadFrom(Plugin)
SysTypes = Asm.GetType(Asm.GetName.Name + ".frmMain")
Dim IsForm As Boolean = GetType(Form).IsAssignableFrom(SysTypes)
If IsForm Then
Dim tmpForm As Form = CType(Activator.CreateInstance(SysTypes), Form)
這讓我在正確的道路上,謝謝! – Joe 2010-08-24 22:28:18