in the OnButtonAdd() event handler for the button
1. assume m_sum, m_add1 and m_add2 are integer class member variables which were defined using ClassWizard (VC++ 6.0 compiler), just call UpdateData() after setting m_sum = m_add1 + m_add2.
void OnButtonAdd()
{
// move window text into member variables
UpdateData(TRUE);
m_sum = m_dat1 + m_data2;
// move data member variables back to windows
UpdateData(FALSE);
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
very similar to the code I already posted. Assume you have a Read button Note: there are other c++ ways to convert from std::string to ints, what I show below works most of the time but will not catch errors in the data read from the xls file or integer overflow problems.
void OnButtonRead()
{
// do something to read the xls file into member
// this assumes the data is read into std::string object
string add1 = ??? // read xls
string add2 = ??? // read from xls
m_add1 = atoi(add1.c_str());
m_add2 = atoi(add2.c_str());
m_sum = m_add1 + m_add2;
UpdateData(FALSE);
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343