Not what I want. It is for my wife. I want a textbox that she can enter a long calculation into, i.e. - 3+6+4*8-9+6*7...., she does insurance work.
I want to take that expression and put it into a messagebox to get the result. That is the easiest way to get the result of an expression. I don't want to write a bunch of code parsing this and that.
Your best off doing what Atheist said unless you want to make a textbox for each number in the calculation.
The best way to do what your trying to do is to make a calculator or use the one provided by windows.
That is exactly what I am trying to do, make a calculator. One that will take 5 or 6 expressions at one time and has a checkbox to be the topmost form. I am trying to be lazy by just dumping the expression into messagebox, but I can't figure out how to convert the string to something that messagebox likes.
If your putting the equation in one textbox then you must calculate this equation and store it in a variable such as result and then have a messagebox display result: msgbox(result).
Well, I can put the equation directly in code into a messagebox and it calculates the answer. That is what I want. I don't want to write the code to do the calculation, messagebox will do it for me if I can convert the string to something it likes.
I've found something promising but not sure how to use it:
Msgbox(textbox1.text.sum"put the arguments here")
But i have no idea what to put in the arguments, have a search on google of that function.
In this case the simplification you want is really making the problem much harder, as in anti-simplification.
By doing it this way, you'll have to first split the string entered in the textbox into it's individual parts. Then you'll have to detect the pluses, minuses etc.; separate those from the numbers and then perform the indicated operations.
That's far more complicated than it needs to be.
An alternative would be to just enter one number into each of multiple textboxes.
Since you are looking for speed, I would suggest maybe one box to enter numbers into. After a number is entered she can enter an operator off of her keypad (or whatever is available). Upon the program detecting a keystroke of an operator your program would check the textbox value to see if it is an allowed entry (a number). Next you would save the indicated operation in any number of ways and simultaneously clear the textbox. When the next number is entered, the indicated operation would be performed on those two numbers and, again, the textbox would be cleared.
I think that should somewhat simplify the code and come closer to the order of operations that you desire to set up for her.
There are no doubt other methods that might prove to be also easier than your first suggestion.
Yes as fourblades suggested you have two options: have one textbox and do comlicated stuff like splitting it, detecting wats in it and stuff or having a number of textboxes for each number that you want to calculate.
you could pass it a string, i.e. "msgbox(" & textbox1.text & ")", which you could then compile + run. but i don't know how you would do that. its an advanced topic