title: VB6 Compile Error: User-defined type not defined
body: <p>I am working on an equation grapher in visual basic 6, but I am encountering an error upon running my program. I have narrowed down the error to the below block of code.   </p>
  
  <pre><code>Option Explicit
  
  Private Sub cmdGraph_Click()
  Dim script_control As MSScriptControlCtl.ScriptControl
  Dim x As Single
  Dim y1 As Single
  Dim y2 As Single
  
  ' Make a script control.
  Set script_control = New MSScriptControl.ScriptControl
  script_control.Language = "VBScript"
  
  ' Define the function.
  script_control.AddCode _
      "Function TheFunction(X)" &amp; vbCrLf &amp; _
      "    TheFunction = " &amp; txtExpression.Text &amp; vbCrLf &amp; _
      "End Function"
  
  ' Graph the equation.
  y1 = script_control.Eval("TheFunction(" &amp; xmin &amp; ")")
  For x = xmin + Dx To xmax Step Dx
      ' Evaluate the next value.
      y2 = script_control.Eval("TheFunction(" &amp; x &amp; ")")
  
      ' Draw the next line.
      picGraph.Line (x - Dx, y1)-(x, y2)
  
      ' Save the current Y value.
      y1 = y2
  Next x
  
  End Sub
  </code></pre>
  
  <p>I have checked the components: </p>
  
  <ul>
  <li>Microsoft windows common controls 6.0</li>
  <li>Microsoft windows common controls- 2 6.0</li>
  <li>Microsoft script control 1.0</li>
  </ul>
  
  <p>so I don't think the problem lies within components. </p>
  
  <p>The code highlighted is:</p>
  
  <pre><code>New MSScriptControl.ScriptControl
  </code></pre>
  
  <p>on line no. 10 of the code block I provided. Any help on what the problem could be would be appreciated, thanks.     </p>
  
  <p><strong>Edit:</strong> I Changed the 4th line of the code block to:</p>
  
  <pre><code>Dim script_control As MSScriptControl.ScriptControl
  </code></pre>
  
  <p>opposed to: </p>
  
  <pre><code>Dim script_control As MSScriptControl.ScriptControl
  </code></pre>
  
  <p>The highlighted text is now the 4th line of the code block.</p>