Rick has already written the basic solution in Solution1, here again in more detail:
To display a summary of three other text fields in the text field EdtDescription, a simple solution would be to react on EN_CHANGE of the three fields and call a member function there, which updates the EdtDescription text field.
Since it seems to be a dialog, message map entries like the following would be needed first:
ON_EN_CHANGE(IDC_EDT_COMPANYNAME, &CServicesDlg::OnEnChangeEdtCompanyname)
ON_EN_CHANGE(IDC_EDT_SERVICENAME, &CServicesDlg::OnEnChangeEdtServicename)
ON_EN_CHANGE(IDC_EDT_PORTTCP, &CServicesDlg::OnEnChangeEdtPorttcp)
An extension of DoDataExchange() would be recommended, even if it would work without. First arrange a variable in the class for each control:
private:
CEdit m_EdtCompanyName, m_EdtServiceName, m_EdtPortTCP, m_EdtDescription;
then add the following entries to DoDataExchange():
DDX_Control(pDX, IDC_EDT_COMPANYNAME, m_EdtCompanyName);
DDX_Control(pDX, IDC_EDT_SERVICENAME, m_EdtServiceName);
DDX_Control(pDX, IDC_EDT_PORTTCP, m_EdtPortTCP);
DDX_Control(pDX, IDC_EDT_DESCRIPTION, m_EdtDescription);
In each of the three handlers you could now call a common function:
void CServicesDlg::OnEnChangeEdtCompanyname()
{
RenewDescription(); }
After that you only need a function that creates the text field with the summary:
void CServicesDlg::RenewDescription()
{
CString companyName, serviceName, portTCP, description;
m_EdtCompanyName.GetWindowText(companyName);
m_EdtServiceName.GetWindowText(serviceName);
m_EdtPortTCP.GetWindowText(portTCP);
description.Format( TEXT("Company: %s\nService: %s\nPort: %s\n") ,companyName, serviceName, portTCP);
m_EdtDescription.SetWindowText(description);