tags:

views:

55

answers:

2

ResultBox1->Text = (sin(TextBox1->Text)) * TextBox2->Text

That is what i would like to work, but im dealing with Strings I cant seem to convert the strings, do the trig, and convert back to string for displaying properly... anyone with an example?

A: 
System::Convert::ToDouble(TextBox1->Text)

You said you're trying to convert a System::String^ so this should work for you.

Ben Burnett
error C2664: 'atof' : cannot convert parameter 1 from 'System::String ^' to 'const char *'1> No user-defined-conversion operator available, or1> Cannot convert a managed type to an unmanaged type
Smoka
@Smoka: You are not using the WinAPI then; you're using .NET.
James McNellis
System::Convert::ToDouble(TextBox1->Text) then?
Ben Burnett
+1  A: 

If you're having trouble converting strings it might be because the string encoding might not be what you thought it was. If you use _tcstod and datatypes such as LPTSTR then you can cope with either ANSI or Unicode.

Edit: This answer was given when the question was asking about winapi. Now the poster has clarified that the question intended to ask about .net, so this answer is irrelevant.

Windows programmer