

As you can see, you can map the EDIT to more types of variables than just a CString. The above is with the previous rows on the table stripped out. I assume your linked article is incorrect as GetWindowText does not return a CString.īy the way, with Visual Assist (a third-party extension) it shows the options correctly for Intellisense:īy the way, you may find this article useful ( Dialog box controls and variable types). If you do decide to map to a CEdit (a Control instead of a Value) then as you found out: // Get the value from the control This way we use our mapped CString to the EDIT control This way you get the current text value from the edit control, without even creating a CEdit control member variable This shows both: void CTestDialogDlg::OnBnClickedButton1() Or, you can use GetDlgItemText if you want to just get the value directly from the control, and avoid creating a variable. This creates the DDX_Text entry that was referred to in the comments: void CTestDialogDlg::DoDataExchange(CDataExchange* pDX) If you select Value, then you can map it to a CString: When you add a EDIT control to a dialog, and you go to map it to a variable, you have two choices: Read text from edit control in MFC and VS2010 You can then retrieve the text in the edit box like this:ĬString filePath1 = m_EditCtrl.GetWindowText() error C3867: 'CWnd::GetWindowTextW': non-standard syntax use '&' to create a pointer to member error C2661: 'CWnd::GetWindowTextW': no overloaded function takes 0 argumentsĬString foostring= edit_name.GetWindowTextW details given except the object's blurb textĬString foostring= edit_name.GetWindowTextW() IDE shows error squiggle at dot "name.GetWi" with no pop-up Void CSendMessageWithActualDataDlg::DoDataExchange(CDataExchange* pDX)ĭDX_Control(pDX, IDC_EDIT_NAME, edit_name) My code: //the auto generated stuff (by right-click on editbox add variable to control option)
