help on eval

robert black

Member
Licensed User
Longtime User
Sub Globals

End Sub

Sub App_Start
Form1.Show
End Sub

Sub Button1_Click
textbox1.Text="5*(4+8)/-21"
s=textbox1.Text
msgbox((s))
textbox2.Text=(s)
end sub

can anyone please explian why on the first pass this works as expected showing
answer in both msgbox and textbox2 but on second click format exception error on the varible 's' occurs
i thought that as declaring 's' only in the 'click' sub it would be discarded after use
then reinitialised on subsequent clicks of 'button1'

look forward to reply
please note parentheses around 's' at msgbox and textbox2
seems to evaluate equation
rb
 
Last edited:
Top