Hej
Er der nogen der kan oversætte denne vb.net kode til vb6
så ville jeg blive mega glad :-)
Set a reference to COM Microsoft Script Control 1.0
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = Evaluator.Evaluate(TextBox1.Text).ToString
End Sub
End Class
Public NotInheritable Class Evaluator
Private Shared mScriptControl As MSScriptControl.ScriptControlClass
Shared Sub New()
mScriptControl = New MSScriptControl.ScriptControlClass
mScriptControl.Language = "VBScript"
mScriptControl.AllowUI = False
End Sub
Public Shared Function Evaluate(ByVal s As String) As Double
mScriptControl.Reset()
Try
Return CDbl(mScriptControl.Eval(s))
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Function
End Class