Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:55:08+00:00 2026-06-02T02:55:08+00:00

I am want to make a calculator on visual studio 2010 using MFC application.

  • 0

I am want to make a calculator on visual studio 2010 using MFC application. For this i used a dialog box to create calculator and add buttons and edit boxes. As we know that edit boxes are used as input. So i want to make the input as float input. So that’s what the below sentence is :

There is a sentence : First choose two edit boxes and placed them on dialog. Use the Class Wizard from the View menu to connect each to a float, value number1 or number2 .

Edit boxes are there. Now how to connect them to a float, value number 1 ? What’s the procedure?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:55:11+00:00Added an answer on June 2, 2026 at 2:55 am

    If I understand your question correctly, you want to bind the edit boxes to float member variables of your dialog box. This is called dialog data exchange. In this answer, I will try to explain how to achieve this with code (it should be more helpful than teaching Class Wizard).

    Basically, you define two float member variables in your dialog box, along with their accessors:

    class CYourDialog : CDialog
    {
        // ...
    
    public:
        float GetNumber1() const {
            return m_number1;
        }
    
        void SetNumber1(float val) {
            m_number1 = val;
        }
    
        float GetNumber2() const {
            return m_number2;
        }
    
        void SetNumber2(float val) {
            m_number2 = val;
        }
    
    private:
        float m_number1;
        float m_number2;
    };
    

    Then, you override the DoDataExchange() method of the dialog box, and call DDX_Text() from there to bind the member variables to your controls:

    void CYourDialog::DoDataExchange(CDataExchange *dx)
    {
        CDialog::DoDataExchange(dx);
        DDX_Text(dx, IDC_NUMBER1_CONTROL_ID, m_number1);
        DDX_Text(dx, IDC_NUMBER2_CONTROL_ID, m_number2);
    }
    

    From there, the MFC framework will automatically populate the edit boxes with the values of the member variables on dialog initialization, and update the member variables with the values of the edit boxes when the OK button is clicked. This is a good thing because you only have to read and write to these member variables instead of manipulating the edit boxes directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application that uses a shipping calculator on an external
I want to make a calculator and add it to the Windows 7 start
I just started writing a customer application in C#, using Visual Studio design mode
Want to code a key pad for an calculator. What I want to make
I want make datetimepicker in my project. Using jquery how it is possible? I
I want make interactive application where user launches it and can do various task
I am traversing a HTML document using javascript DOM. I want make a list
Background: Many years ago, I inherited a codebase that was using the Visual Studio
I'm using jQuery to make a calculator. The issue is that on keydown, I
I want to make a application that calculates the distance between the user's current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.