a quick question about textboxes and typecasting to numbers

I want to take an input from the user (via the textbox) and then typecast it to a float to use it as part of a calculation but unsure how to do this. I've tried the obvious (to me):
float value = <float>textbox->Text
but it gives me a compiler error.
So i was wondering if it was possible to do this.If so, how

Any recommendation would be greatly appreciated.

It should also be noted that i'm not limited to a textbox as long as input from the user is possble.

thank you.


Answer this question

a quick question about textboxes and typecasting to numbers

  • Kmc85

    There is no way to do this conversion automatically. If you are using ISO/IEC C++ then take a look at the atof() function; if you are using Managed C++ or C++/CLI then take a look at the ToSingle() function.



  • a quick question about textboxes and typecasting to numbers