Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. VS2010 CLR double to String, String to double MSVC/C++ methods?

VS2010 CLR double to String, String to double MSVC/C++ methods?

Scheduled Pinned Locked Moved ATL / WTL / STL
c++dotnetquestion
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M meace1234

    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 ? :~

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    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

    M 2 Replies Last reply
    0
    • L Lost User

      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

      M Offline
      M Offline
      meace1234
      wrote on last edited by
      #3

      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 ??

      L R 2 Replies Last reply
      0
      • M meace1234

        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 ??

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        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

        M 1 Reply Last reply
        0
        • L Lost User

          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

          M Offline
          M Offline
          meace1234
          wrote on last edited by
          #5

          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?

          L 1 Reply Last reply
          0
          • M meace1234

            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?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            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

            M 1 Reply Last reply
            0
            • L Lost User

              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

              M Offline
              M Offline
              meace1234
              wrote on last edited by
              #7

              //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???

              M 1 Reply Last reply
              0
              • L Lost User

                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

                M Offline
                M Offline
                meace1234
                wrote on last edited by
                #8

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

                L 1 Reply Last reply
                0
                • M meace1234

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

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  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

                  1 Reply Last reply
                  0
                  • M meace1234

                    //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???

                    M Offline
                    M Offline
                    meace1234
                    wrote on last edited by
                    #10

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

                    1 Reply Last reply
                    0
                    • M meace1234

                      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 ??

                      R Offline
                      R Offline
                      rana ray
                      wrote on last edited by
                      #11

                      Did you try to find out on MSDN? regards, Vatsa www.objectiveprogramming.com

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups