Imports System
Imports System.IO
Imports Microsoft.Scripting
Imports Microsoft.Scripting.Hosting
Imports IronPython.Hosting
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' VB SENDS A VARIABLE TO IRONPYTHON, WHICH INCS AND RETURNS IT...... http://www.chrisumbel.com/article/scripting_ironpython_dlr
'/* bring up an IronPython runtime */
dim engine = Python.CreateEngine()
dim scope = engine.CreateScope()
' create a Python variable "i" with the value 1
scope.SetVariable( "i", 123 )
' this script will simply add 1 to it
dim source = engine.CreateScriptSourceFromString( "i += 10" )
'/* run the script in the IronPython runtime */
source.Execute(scope)
' /* pull the value back out of IronPython and display it */
Console.WriteLine(scope.GetVariable("i").ToString())
End Sub
结束类