Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFC edit control update

I try to update an edit control's text, using it's added variable, which is a CString but i'm failing it.

m_sNrAuto = "some text";  
UpdateData(TRUE);

I also tried using UpdateWindow(), but the edit control remains blank. I know i can do it by using SetWindowText(), but i also saw some snippets where SetWindowText() it's not used, the update is done by passing a value to an affiliated CString.

like image 351
MRM Avatar asked Jun 14 '13 15:06

MRM


1 Answers

Try UpdateData(false);

  • true means Control=>Data

  • false means Data=>Control

Sometimes you have to do

UpdateData(true);  // snapshot ALL controls data
m_sNrAuto = "some text";  // tweak the one you actually need updated
UpdateData(false);  // this pushes ALL data, not just the one you tweaked
like image 120
franji1 Avatar answered Sep 25 '22 02:09

franji1