[Gambas-user] Eval() and gb.eval

tobias tobiasboe1 at ...20...
Sat Sep 24 17:44:16 CEST 2011


On 24.09.2011 17:12, Demosthenes Koptsis wrote:
> i have the next lines to make an gb.eval example
>
> --------------------------------
> Public Sub btnEval_Click()
>
>    Dim hExpression As Expression
>    hExpression = New Expression
>
>    hExpression.Text = txtEval.Text
>    txtResult.Text&= CStr(hExpression.Value)&  gb.NewLine
>
>    Print Eval(txtEval.Text)
>
> Catch
>    txtResult.Text&= "Error code:"&  Error.Code&  ", "&  Error.Text&
> gb.NewLine
>    Error.Clear
>
> End
> --------------------------------
>
>
> with line
>    Print Eval(txtEval.Text)
>
> i get True for "2>1"
>
> with line
>    txtResult.Text&= CStr(hExpression.Value)&  gb.NewLine
>
> i get the first letter "T" for true
> nothing for False
>
> is this the desired output? i expected True / False as EVAL()
>
i don't know, for me, it's the desired output.
Print takes an expression and prints it. CStr() converts an expression 
to a string. and the string representation of True is "T" while False is 
Null




More information about the User mailing list