data sharing between dialog boxes
Posted on 1998-08-13
I have several dialog boxes in my project and I need to take amounts from one screen to another, will someone please tell me how to share the data between them. I have already create variables for the edit boxes which I am trying to share data between. The data I am trying to get is in CService2Dialog and I am trying to place it in CServiceDialog. The variables are m_billtime(CServiceDialog) & and want it to come from m_totlab(CService2Dialog). These variables are double. When the user hits the "Calculate" button on page 1 the amount should appear in the corresponding edit box. If this can be done without hitting the button it does not matter but I figured it might be easier. Please tell me exactly where to put the statements because I do not understand Visual C++ 5.0 completley at this point.
Also if it is not to much trouble show me how to get zeros at the end of the number. eg. if the data is 1, I want it to show 1.00(dollar figures).
Thank You for the much need help!
I apologize for enter this question the second time but the first answer didn't work because I am only new to programming in Visual C++ 5.0 and I could not figure it out after hours of struggling.
//This is the Calculate button on page 1.
// TODO: Add your control notification handler code here
UpdateData(TRUE); // get data from controls
//Here is where I want to recieve data from page 2 and place it here to calculate the data on page 1.
//output the new data recieved.
//ignore this it is only other calculations.
m_tottravel.Format("%.2f", atof(m_billtravel)*atof(m_ratetravel)); //calculate total labour
m_totinv.Format("%.2f", atof(m_totparts)+atof(m_tottravel)+atof(m_totlabour)); //calc total invoice
UpdateData(FALSE); // send data to controls