I want to add two numbers in MFC with using CString variables. For example: CString m_nedit1, CString m_nedit2 and I need to store it in CString m_nedit3.
All three edit controls are value type(CString) not a control type
Please provide your answer.
This is a question on Dialog Data Exchange
On the button press you want to use UpdateData(TRUE) to set the CString control values m_nedit1 and m_nedit2.
Then you build your m_nedit3 string in whatever way you mean by "calculate". Then you synchronise the change back to the dialog controls with UpdateData(FALSE).
For example lets presume you meant concatenation:
UpdateData(TRUE);
m_nedit3 = m_nedit1 + m_nedit2;
UpdateData(FALSE);
You should handle the case UpdateData(FALSE) returning FALSE. This would mean the sync failed accordingly to any DDV conditions you may have imposed, e.g. maximum string length.
intordoulbebut not of typeCString. - Jabberwocky