Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

displaying non-document items

  I am developing a dialog-box based application that receives input from the user through an edit-box. What I want the program to do is to perform some calculations using this input plus some other data from the program's document class and display the results. The results themselves are not part of the document class(in fact this is a database application and uses a recordset). From what I can gather, data is displayed by linking a dialog control with a data member. What happens if the information to be displayed is not a data member? I really don't want to make these results part of my document class as it will affect the entire database. Probably a simple solution but I am new to using MFC.
0
mspx
Asked:
mspx
1 Solution
 
dvestCommented:
Once you have the result of your calculation, you could show the results as follows:

OnCalculationComplete(CString result)
{
      CEdit* pEdit;
      pEdit=(CEdit*)GetDlgItem(IDC_RESULT); //set ptr to your edit box
      pEdit->SetWindowText(result);
}

If the answer is numeric, you can convert it like this:
char buffer[12]; //use max # of digits in place of "12"
itoa(integerResult, buffer, 10);
// the "10" in this call is the base of the number (base 10, octal,hex,etc.)
CString result=buffer;

I hope this is what you are after.  Let me know if clarification is needed.
David
      
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now