Math Output in DialogBased Program With MSVC++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cyrus
    New Member
    • Jun 2007
    • 4

    Math Output in DialogBased Program With MSVC++

    Hi friends:
    I know this question might seem very simple but I need it urgently for my homework.

    "Imagine I want to write a dialogbased program.It takes two integers (m_a and m_b) from user and shows the sum of them as result.It contains three edit boxes and a button control to exe the sum process.I use the following command:

    void CMATHDlg::OnSum ()
    {
    m_sum=m_a+m_b;
    MessageBox(m_su m);
    UpdateData(TRUE );
    }


    But after running, the sum result does not appear in the related editbox.And also it gives me error for type conversion.

    WHAT COMMAND SHOULD I USE INSTEAD OF MessageBox?

    I also will be thankful if you could introduce me a book for mathematical aspects of vcpp.

    Thank you so much
  • Savage
    Recognized Expert Top Contributor
    • Feb 2007
    • 1759

    #2
    Originally posted by cyrus
    Hi friends:
    I know this question might seem very simple but I need it urgently for my homework.

    "Imagine I want to write a dialogbased program.It takes two integers (m_a and m_b) from user and shows the sum of them as result.It contains three edit boxes and a button control to exe the sum process.I use the following command:

    void CMATHDlg::OnSum ()
    {
    m_sum=m_a+m_b;
    MessageBox(m_su m);
    UpdateData(TRUE );
    }


    But after running, the sum result does not appear in the related editbox.And also it gives me error for type conversion.

    WHAT COMMAND SHOULD I USE INSTEAD OF MessageBox?

    I also will be thankful if you could introduce me a book for mathematical aspects of vcpp.

    Thank you so much
    Let me see now:

    Do you wish to show result in editbox or in a message box?

    Savage

    Comment

    • cyrus
      New Member
      • Jun 2007
      • 4

      #3
      Originally posted by Savage
      Let me see now:

      Do you wish to show result in editbox or in a message box?

      Savage
      Hi:

      Of course I think showing the result in editbox will be more suitable but would you please tell me about both (showing in messagebox or editbox)

      Thank you

      Comment

      • Savage
        Recognized Expert Top Contributor
        • Feb 2007
        • 1759

        #4
        Originally posted by cyrus
        Hi:

        Of course I think showing the result in editbox will be more suitable but would you please tell me about both (showing in messagebox or editbox)

        Thank you
        If you want to display it into MessageBox,use method show:


        MessageBox::Sho w(String^ text,String^Cap tion,MessageBox buttons,Message BoxIcon);

        e.g:

        MessageBox::Sho w(result,"Resul t is",MessageBoxB uttons::OK,Mess ageBoxIcon::Inf ormation)

        for TextBox,see Text property..

        Also you will need to convert from int to String^
        Savage

        Comment

        • cyrus
          New Member
          • Jun 2007
          • 4

          #5
          Originally posted by Savage
          If you want to display it into MessageBox,use method show:


          MessageBox::Sho w(String^ text,String^Cap tion,MessageBox buttons,Message BoxIcon);

          e.g:

          MessageBox::Sho w(result,"Resul t is",MessageBoxB uttons::OK,Mess ageBoxIcon::Inf ormation)

          for TextBox,see Text property..

          Also you will need to convert from int to String^
          Savage
          Thank you so much Savage
          Would you please tell me about the showing in editbox too.I check "Want return" in style tab but should I add a function like EN_CHANGE OR EN_UPDATE?

          Thank you again

          Comment

          • cyrus
            New Member
            • Jun 2007
            • 4

            #6
            Originally posted by cyrus
            Thank you so much Savage
            Would you please tell me about the showing in editbox too.I check "Want return" in style tab but should I add a function like EN_CHANGE OR EN_UPDATE?

            Thank you again
            I know you might be busy but please take a look at this example in :
            http://rapidshare.com/files/37902951/MATHOUTPUT.rar

            It's not my main project I only created a simple example to learn the way math result can be shown in edit box.

            Thank you

            Comment

            • Savage
              Recognized Expert Top Contributor
              • Feb 2007
              • 1759

              #7
              Originally posted by cyrus
              I know you might be busy but please take a look at this example in :
              http://rapidshare.com/files/37902951/MATHOUTPUT.rar

              It's not my main project I only created a simple example to learn the way math result can be shown in edit box.

              Thank you
              You are usimg VC 6,right?

              I'm using Microsoft Vc express 2005,so I have some problems viewing your project.

              Sorry,but I think that there is no editbox in M$ VC but there is textbox.They are same,I think.If they are same check for Text methode..

              Savage

              Comment

              Working...