How change edit control's text?

前端 未结 3 1847
无人共我
无人共我 2021-01-23 22:31

I have a button and text control in MFC dialog window, when I click on button, in edit control must be replaced for example \"hello world\".
but if I write

3条回答
  •  悲哀的现实
    2021-01-23 23:13

    First you should add a variable to edit.To do that right click on the edit and choose Add Variable... in Add Member variable Wizard change Category from Control to Value after that in the Variable name field type a name like m_EditValue then click finish.from now you can change the Edit Control simply by following code.

       void CAboutDlg::OnBnClickedButton1()
        {
            // TODO: Add your control notification handler code here
            m_EditValue = L"Hello World";
            UpdateData(FALSE);
        }
    

提交回复
热议问题