I have two questions:
1. How to evaluate something like (2 + 2) * 2 as an integer when I enter it into a text box?
"Cast from string "2 + 2" to type 'Long' is not valid."
2. How can I prevent arithmetic overflow (even happens with some SMALL simple equations), and have large numbers like Calculator that comes with Windows?
1. How to evaluate something like (2 + 2) * 2 as an integer when I enter it into a text box?
Visual Basic:
' Tried this
' calcEq.Text = "2 + 2"
MsgBox(CType(calcEq.Text, Long))
"Cast from string "2 + 2" to type 'Long' is not valid."
2. How can I prevent arithmetic overflow (even happens with some SMALL simple equations), and have large numbers like Calculator that comes with Windows?
Last edited: