I've been trying to put a few formulas into a program, but the only one I've started referencing won't put a value into an edit box. Here's the code I think is important to the problem:
bool CCombinedGasLawDlg::CalcGasLaw()
{
if(counter == 5){
switch(flag){
case 63:
return(FALSE);
case 62:
m_Pr1 = (m_Tm1 / m_Vl1) * ((m_Pr2 * m_Vl2) /m_Tm2);
break;
case 61:
m_Pr2 = ((m_Vl1 * m_Pr1) /m_Tm1) * (m_Tm2 / m_Vl2);
break;
case 59:
m_Vl1 = (m_Tm1 / m_Pr1) * ((m_Pr2 * m_Vl2) / m_Tm2);
break;
case 55:
m_Vl2 = ((m_Vl1 * m_Pr1) / m_Tm1) * (m_Tm2 / m_Pr2);
break;
case 47:
m_Tm1 = (m_Pr1 * m_Vl1) * (m_Tm2 / (m_Pr2 * m_Vl2));
break;
case 31:
m_Tm2 = ((m_Pr1 * m_Vl1) / m_Tm1) * (m_Pr2 * m_Vl2);
break;
default:
counter = 0;
if(flag & 32 == 32){
counter += 1;
}
if(flag & 16 == 16){
counter += 1;
}
if(flag & 8 == 8){
counter += 1;
}
if(flag & 4 == 4){
counter += 1;
}
if(flag & 2 == 2){
counter += 1;
}
if(flag & 1 == 1){
counter += 1;
}
return(FALSE);
}
UpdateData(FALSE);
}
return(TRUE);
}
void CCombinedGasLawDlg::OnChangePreassure1()
{
UpdateData(TRUE);
if(m_Pr1 != 0){
counter += 1;
flag|=1;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
void CCombinedGasLawDlg::OnChangeVolume1()
{
UpdateData(TRUE);
if(m_Vl1 != 0){
counter += 1;
flag|=4;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
void CCombinedGasLawDlg::OnChangeVolume2()
{
UpdateData(TRUE);
if(m_Vl2 != 0){
counter += 1;
flag|=8;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
void CCombinedGasLawDlg::OnChangeTemperature2()
{
UpdateData(TRUE);
if(m_Tm1 != 0){
counter += 1;
flag|=16;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
void CCombinedGasLawDlg::OnChangeTemperature1()
{
UpdateData(TRUE);
if(m_Tm1 != 0){
counter += 1;
flag|=32;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
void CCombinedGasLawDlg::OnChangePreassure2()
{
UpdateData(TRUE);
if(m_Pr2 != 0){
counter += 2;
flag|=2;
}
else{
MessageBox(m_ErrLowValue);
}
if(counter == 5){
if((CalcGasLaw() == FALSE)){
MessageBox(m_ErrFewValue);
}
}
}
Each of the OnChange functions is a message handler for one of six dialog boxes. m_Pr1, m_Pr2, m_Vl1, m_Vl2, m_Tm1 and m_Tm2 are variables to hold the values in said boxes. Each of the OnChange functions is supposed to be called after the value in the box is changed by the user. These functions then send an error if the value is too low, or set a flag and increment a counter if the value is appropriate. If the counter is set to 5 these functions call the Calculation function to get the final value. This value should then be placed into it's edit box. This never happens, and I don't know why. I don't recieve any programing errors in the compiler or when running the program. Help would be appreciated.