title: Calling Python script from windows form
body: <p>I'm an IronPython novice and would like some help.  I have a windows form that I have created in Visual Basic 2010 Express, which contains two text-boxes ('<strong>txtNumber</strong>' and '<strong>txtResult</strong>') and a button ('<strong>btnSquare</strong>').  What I want to do is be able to call the below Python script ('<strong>Square.py</strong>') on clicking the button on the form;</p>
  
  <pre><code>class SquarePython:
  
      def __init__(self, number):
  
          self.sq = number*number
  </code></pre>
  
  <p>This script should square the number that is input in to '<strong>txtNumber</strong>' and then output the result in to '<strong>txtResult</strong>'.  I know this is almost too simple, but I just need to know the basics.  Here's what I have so far in my VB code;</p>
  
  <pre><code>Imports Microsoft.Scripting.Hosting
  Imports IronPython.Hosting
  Imports IronPython.Runtime.Types
  
  Public Class Square
  
      Private Sub btnSquare_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSquare.Click
  
          Dim runtime As ScriptRuntime = Python.CreateRuntime
  
          Dim scope As ScriptScope = runtime.ExecuteFile("Square.py")
  
      End Sub
  
  End Class
  </code></pre>
  
  <p>Thanks in advance.</p>