Archive for the ‘GUI’ Category

CLR GUI for VS2010 C++

January 16, 2012

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”);
}