在平台开发中,常常会使用到加载一些外部的dll或者调用一些方法,那么,一般情况下,均可通过LoadAssembly来加载。
dim obj= LoadAssembly(程序集名称,要加载的类名)

如下面语句:

 dim regex= LoadAssembly("System.dll","System.Text.RegularExpressions.Regex","^[0-9]*$")
    '参数是需要验证的字符串,返回结果为该字符串是否符合规则
    dim temp=regex.IsMatch("123"))

但是如果是系统本身已加载的dll,则没有必要再用LoadAssembly来加载,其一是因为LoadAssenbly必须加载本目录下的文件,其二是因为从文件加载时速度会比较慢。
实际上,System.dll在系统中已经加载,所以我们只需要用CreateObject来创建即可,用法如下:

dim regex=createObject("System.Text.RegularExpressions.Regex","^[0-9]*$")
dim temp=regex.IsMatch("123")
msgbox(temp)

直接用CreateObject来创建已经加载了的dll文件中的类。
今天整理了平台启动后所加载的所有dll文件,供大家参考,以下DLL中的类,均可用CreateObject进行创建:

mscorlib.dll
DLSOFT.dll
System.Windows.Forms.dll
System.dll
System.Drawing.dll
FWFramework.Client.MainPlat.dll
DevExpress.Utils.v11.1.dll
System.Data.dll
System.Xml.dll
FWFramework.Client.Common.dll
FWFramework.Common.dll
mscorlib.resources.dll
FWFramework.TableReader.dll
DevExpress.OfficeSkins.v11.1.dll
DevExpress.XtraEditors.v11.1.dll
DevExpress.Data.v11.1.dll
Accessibility.dll
System.Windows.Forms.resources.dll
Service.dll
System.Web.Services.dll
System.Configuration.dll
Service.XmlSerializers.dll
DevExpress.XtraEditors.v11.1.resources.dll
System.Management.dll
PlugInManager.dll
FWFramework.Client.BaseControls.dll
FWFramework.Client.PartBase.dll
FWFramework.Client.Design.dll
DevExpress.XtraBars.v11.1.dll
Desktop.dll
FWFramework.Client.TextEditors.dll
Microsoft.mshtml.dll
DevExpress.XtraGrid.v11.1.dll
DevExpress.Printing.v11.1.Core.dll
FWFramework.Client.Designer.dll
DevExpress.XtraBars.v11.1.resources.dll
DevExpress.XtraTreeList.v11.1.dll
FWFramework.CommonFunction.dll
FWFramework.Client.Design.FuncExtensions.dll
DevExpress.XtraLayout.v11.1.dll
DevExpress.XtraLayout.v11.1.resources.dll
DevExpress.XtraGrid.v11.1.resources.dll
FWFramework.Client.DbManager.dll

原文地址:http://bbs.delit.cn/thread-199-1-1.html

转载请注明出处:

撰写人:度量科技http://www.delit.cn