看了網上很多關於DotNet動態創建類的實例的文章
大家可以參考http://www
利用Microsoft
以下是引用片段
Public Shared Function CompileExecutable()Function CompileExecutable(ByVal sourceName As String
Dim sourceFile As FileInfo = New FileInfo(sourceName)
Dim provider As CodeDomProvider = Nothing
Dim compileOk As Boolean = False
If sourceFile
provider = New Microsoft
ElseIf sourceFile
provider = New Microsoft
Else
Console
End If
If Not provider Is Nothing Then
Dim dllName As String = String
DLLPath
sourceFile
ReturnDLLName = dllName
Dim cp As CompilerParameters = New CompilerParameters()
cp
cp
cp
cp
Dim cr As CompilerResults = provider
sourceName)
If cr
Console
sourceName
Dim ce As CompilerError
For Each ce In cr
Console
Console
Next ce
Else
Console
sourceName
End If
If cr
compileOk = False
Else
compileOk = True
End If
End If
Return compileOk
End Function
以下是引用片段
Dim strSourceFileName As String = Server
Dim strDllPath As String = Server
Dim strDllName As String =
CompileExecutable(strSourceFileName
Dim a As [Assembly] = [Assembly]
Dim myType As System
Dim obj As Object = Activator
以下是引用片段
Public Class Class
Public i As Integer
End Class
From:http://tw.wingwit.com/Article/program/net/201311/15309.html