   Visual C++ .NET Bible - New MFC Application
  Ok,I''m brand new to MFC / Windows programming in general. Now this mainly is in reference to the Visual Studio .NET creating your first MFC Application in Chapter 1 (if anyone owns that)Using VS .NET 2002 here.So I''ve created a new Dialog based MFC Application.Added an EDIT Control box and and OK button. When the user clicks the OK button I want it to display what the user currently had residing in the edit control box.Sooo.........Clicked on the EDIT Control box in the dialog-editor. Added a DDX variable of type CString to the edit control ...called it m_strMessageText.Then I added an On button click event handler for the OK button with the following:UpdateData(TRUE);AfxMessageBox(m_strMessageText);  Pretty much verbatum of what I''m supposed to do according to chapter 1. Only thing is, when clicking ok the the message box is always blank. Debugging further m_strMessageText always remains null. wtf?I read that UpdateData(TRUE) will move data from the dialog box controls to the variables. Thereby when clicking OK, whatever exists in edit control box should be moved to m_strMessageText should it not? Am I missing something here?Sorry if I posted this in the wrong forum..yes uber noob. rotten tomato tossing is welcome 
The Code Project has an extensive MFC reference.I disliked MFC - found it confusing to say the least - I''m currently working with WTL, seems ok to me and has much the same capability. ;  No, the UpdateData() function doesn't move data from controls to variables.  The function that does this is DoDataExchange()  In the function, you will need to do something like this: void CDialogMyDialog::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//get values from edit boxDDX_Text(pDX, IDC_MY_EDITCONTROL, m_strMessageText); //create message box AfxMessageBox(m_strMessageText);}Otherwise, you could use the following to transfer the text from the edit control to your member variable anywhere in the code: //transfer text from edit control to variable on lbuttondownvoid CDialogMyDialog::OnLButtonDown(UINT nFlags, CPoint point){//get text from the edit box  GetDlgItemText(IDC_MY_EDITCONTROL, m_strMessageText)CDialog::OnLButtonDown(nFlags, point);}Hope this helps!   [edited by - the_dannobot on February 12, 2004 8:55:29 PM];  Thanks dannobot.I actually figured it out 10 mins after I posted this.Your first code block inside DoDataExchange is what I was missing.I thought VS.NET was supposed to do this automatically for me when using the Add Variable Wizard. At least the book I am reading states this. Perhaps it was because I set my variable in the wizard to a CString  type (which wasn''t in the list box and had to manually type it in).Who knows...ohwell  now I know! thanks. cheers,vizuäl 