CLR GUI for VS2010 C++

Using help from a forum called http://stackoverflow.com , I finally got the String to double and double to String

conversions going.

The CLR gui looks a lil more polished than MFC but requires .NET framework of the correct version when it runs.

The MFC that I got to work first has the String to double and double to string built into the EditText.  You right mouse

and tell what double variable you want the EdtText to use.

________________________________________________

Thanks for checking  out my posting.

Check  out the latest at https://mrobvious.wordpress.com No scraping please…..

________________________________________________

//Here is the conversion part CLR C++ GUI
//CLR isnt too bad… better than MFC yes?

double dblInput1 = 0.0;
double dblInput2 = 0.0;
double dblAnswer = 0.0;
String ^ strInput1;
String ^ strInput2;
strInput1 = this->Input1textBox->Text;
strInput2 = this->Input2textBox->Text;

if (Double::TryParse(strInput1, dblInput1) & Double::TryParse(strInput2, dblInput2))
{
// do something
dblAnswer = dblInput1 + dblInput2;

Answer1textBox->Text = System::Convert::ToString( dblAnswer );
}

else
{
// the text was not a number
MessageBox::Show(“Error”);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: