Solved

displaying non-document items

Posted on 1999-01-02
1
156 Views
Last Modified: 2013-11-20
  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
Comment
Question by:mspx
1 Comment
 
LVL 1

Accepted Solution

by:
dvest earned 50 total points
ID: 1327121
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Prevent this page from creating additional dialogs. 3 611
sum13 challenge 24 121
has22 challenge 11 104
Is there a simple front-end menu system. 9 102
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question