取得或設定所有程式碼
無引數
傳回字串
' 呼叫函數範例
Dim code As New VBNetCode
code.Code = Join(New String() { _
"Public Function TestFunction(Byval x As Double) As Object", _
"Return x ^ 2 + 3", _
"End Function" _
}, vbNewLine))
MsgBox(Code.Run("TestFunction", 2))
' 呼叫副程式範例
Dim code As New VBNetCode
code.Code = Join(New String() { _
"Public Sub TestSub(Byval strMessage As String)", _
"MsgBox(strMessage)", _
"End Sub" _
}, vbNewLine)
code.Run("TestSub", "測試")
Visual Studio .Net 2005 以後相容版本 | vbCode.vb
|
|