By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,871 Members | 2,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,871 IT Pros & Developers. It's quick & easy.

Math Output in DialogBased Program With MSVC++

P: 4
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_sum);
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
Jun 16 '07 #1
Share this Question
Share on Google+
6 Replies


Savage
Expert 100+
P: 1,764
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_sum);
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
Jun 16 '07 #2

P: 4
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
Jun 17 '07 #3

Savage
Expert 100+
P: 1,764
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::Show(String^ text,String^Caption,MessageBoxbuttons,MessageBoxIc on);

e.g:

MessageBox::Show(result,"Result is",MessageBoxButtons::OK,MessageBoxIcon::Informat ion)

for TextBox,see Text property..

Also you will need to convert from int to String^
Savage
Jun 17 '07 #4

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


MessageBox::Show(String^ text,String^Caption,MessageBoxbuttons,MessageBoxIc on);

e.g:

MessageBox::Show(result,"Result is",MessageBoxButtons::OK,MessageBoxIcon::Informat ion)

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
Jun 18 '07 #5

P: 4
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
Jun 18 '07 #6

Savage
Expert 100+
P: 1,764
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
Jun 18 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.