Download the EXEcutable version of the Visual Basic program. It is an .EXE file named FunctionInTextbox.exe.

Download the code to paste into your application, only if you wish to try this out.

' 11/11/05 followup example program
' Do NOT worry about this code at all, but if you are curious
' about arrays and want to look it over, feel free to.

Dim f(10) As Single
Dim g(10) As Single
Dim fSize As Integer
Dim gSize As Integer

Function ff(x As Variant) As Single
    answer = 0
    For i = 0 To fSize - 1 Step 2
        answer = answer + f(i) * x ^ f(i + 1)
    Next i
    ff = answer
End Function

Private Sub cmdFunction_f_Click()
    fString = txtFunction_f.Text & " "
    
    i = 0
    Do While Len(fString) > 0
        whereSpace = InStr(fString, " ")
        f(i) = Val(Left(fString, whereSpace - 1))
        CurrentX = -2.1
        ' Print fString
        fString = Right(fString, Len(fString) - whereSpace)
        i = i + 1
    Loop
    fSize = i
End Sub

Private Sub cmdPlot_Click()
    For i = -1 To 1 Step 0.01
        PSet (i, ff(i))
    Next i
    Form1.ForeColor = vbBlue
    CurrentY = 5
End Sub

Private Sub cmdShowFunction_Click()
    Static showTimes As Integer
    showTimes = showTimes + 1
    Print
    CurrentY = 7 - showTimes
    CurrentX = -2.1
    For i = 0 To fSize - 1 Step 2
        If i > 0 And f(i) > 0 Then Print "+";
        Print Str(f(i));
        
        If f(i + 1) <> 0 Then
            Print "x";
            If (f(i + 1) <> 1) Then
                CurrentY = CurrentY + 0.2
                Print Str(f(i + 1));
                CurrentY = CurrentY - 0.2
            Else
                Print " ";
            End If
        End If
        
    Next i
    Print
End Sub

Private Sub Form_Initialize()
    Line (-2.1, 0)-(2.1, 0)
    Line (0, 8)-(0, -1)
    For i = 1 To 7
        Line (-0.1, i)-(0.1, i)
    Next i
    For x = -2 To 2 Step 0.5
        Line (x, -0.1)-(x, 0.1)
    Next x
    
    CurrentY = 8
    Form1.ForeColor = vbRed
End Sub

Private Sub Form_Load()
    Scale (-2.1, 8)-(2.1, -1)
    Form1.DrawWidth = 2
End Sub