'Create Class from String
'
Dim sDom As String = _ "Public Class tabelturunan" & vbNewLine & _ " Inherits this.parentoff" & vbNewLine & _ " Sub New()" & vbNewLine & _ " MyBase.New()" & vbNewLine & _ " End Sub" & vbNewLine & _ " Sub New(ByVal s As String)" & vbNewLine & _ " MyBase.New(s)" & vbNewLine & _ " End Sub" & vbNewLine & _ " End Class"'
' We create object of the compiler
'
Dim objCodeCompiler As CodeDom.Compiler.CodeDomProvider = CodeDom.Compiler.CodeDomProvider.CreateProvider("VB")'
' Pass parameters into the compiler.
'
Dim objCompilerParameters As New CodeDom.Compiler.CompilerParameters
objCompilerParameters.ReferencedAssemblies.Add("System.dll")
objCompilerParameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
objCompilerParameters.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
objCompilerParameters.ReferencedAssemblies.Add("System.Data.dll")
objCompilerParameters.ReferencedAssemblies.Add("System.XML.dll")
objCompilerParameters.ReferencedAssemblies.Add("kependudukan.exe")
objCompilerParameters.GenerateInMemory = True
'' Get te source code and compile it.
'
Dim objCompileResults As CodeDom.Compiler.CompilerResults = objCodeCompiler.CompileAssemblyFromSource(objCompilerParameters, line)
'' Check for compiler errors.
'
If objCompileResults.Errors.HasErrors Then
MsgBox("Error: Line>" & objCompileResults.Errors(0).Line.ToString & ", " & objCompileResults.Errors(0).ErrorText)
End
End If