VS2010 CLR double to String, String to double MSVC/C++ methods?
-
VS2010 CLR double to String, String to double methods to get data in and out of editText Textboxes in MSVC / VCpp? Are there any good examples for gui on C++ in VS2010 ? :~
-
See here[^] for
Double.ToString()
, and here[^] for the reverse operation.Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Richard, Are there good gui examples for VS2010 C++ for CLR and MFC anywhere? Not even sure if there is a better flavor of gui beyond those...ATL ??
Follow the links I gave you and read the explanations and sample code. You also need to decide whether you are using CLR or MFC; they are not the same.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Follow the links I gave you and read the explanations and sample code. You also need to decide whether you are using CLR or MFC; they are not the same.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Richard Yes, trying to use CLR this time. Would be interested in finding good gui examples for MFC or CLR though. Not even sure about ATL..... Is there a best way to do gui with C++ VS2010?
meace1234 wrote:
trying to use CLR this time.
OK, I've given you the references to the documentation.
meace1234 wrote:
Is there a best way to do gui with C++ VS2010?
I'm not sure what this means.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
See here[^] for
Double.ToString()
, and here[^] for the reverse operation.Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
//How to do conversions for CLR C++ GUI //This worked double dblInput1 = 0.0; double dblInput2 = 0.0; double dblAnswer = 0.0; String ^ strInput1; String ^ strInput2; strInput1 = this->Input1textBox->Text; strInput2 = this->Input2textBox->Text; Double::TryParse(strInput1, dblInput1); Double::TryParse(strInput2, dblInput2); dblAnswer = dblInput1 + dblInput2; Answer1textBox->Text = System::Convert::ToString( dblAnswer ); But, How do i add an If then to handle the TryParse exception???
-
meace1234 wrote:
trying to use CLR this time.
OK, I've given you the references to the documentation.
meace1234 wrote:
Is there a best way to do gui with C++ VS2010?
I'm not sure what this means.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
Here is the conversion part CLR isnt too bad... better than MFC yes? //How to do conversions for CLR C++ GUI 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, show user an error if appropiate MessageBox::Show("Error"); }
-
Here is the conversion part CLR isnt too bad... better than MFC yes? //How to do conversions for CLR C++ GUI 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, show user an error if appropiate MessageBox::Show("Error"); }
That looks OK.
meace1234 wrote:
CLR isnt too bad... better than MFC yes?
No, just different.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
//How to do conversions for CLR C++ GUI //This worked double dblInput1 = 0.0; double dblInput2 = 0.0; double dblAnswer = 0.0; String ^ strInput1; String ^ strInput2; strInput1 = this->Input1textBox->Text; strInput2 = this->Input2textBox->Text; Double::TryParse(strInput1, dblInput1); Double::TryParse(strInput2, dblInput2); dblAnswer = dblInput1 + dblInput2; Answer1textBox->Text = System::Convert::ToString( dblAnswer ); But, How do i add an If then to handle the TryParse exception???
//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”); }
-
Richard, Are there good gui examples for VS2010 C++ for CLR and MFC anywhere? Not even sure if there is a better flavor of gui beyond those...ATL ??
Did you try to find out on MSDN? regards, Vatsa www.objectiveprogramming.com