Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 854
  • Last Modified:

UpdateData(false) in a editbox

I want to UpdateData(false) but only for one of the CEdit Boxes in my Dialog;
I tried:
                CString m_Bild=AnyString; //Value of that CEdit Box
      CEdit m_BildCtrl.UpdateData(false); //Control of that CEdit Box

but it dont updates the data.

0
dkloeck
Asked:
dkloeck
  • 3
  • 2
1 Solution
 
bkfirebirdCommented:
try m_BildCtrl.UpdateData (TRUE)
0
 
Karl Heinz KremerCommented:
The parameter to UpdateData() is called bSaveAndValidate. This means that if this parameter is set to true, you are retrieving data from the control (and validating it). If you set it to false, you are setting the the control (copying from your variable to the control).

Which way do you want your data to go?

The line that you quoted will not work. You need to do it like this:
m_BildCtrl.UpdateData(false);
0
 
bkfirebirdCommented:
oops .... you're right khkremer .... it should actually be UpdateData (false) .... what was i thinking

it that doesnt work simply use
m_BildCtrl.SetWindowText (m_Bild)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Karl Heinz KremerCommented:
I usually get this wrong myself :-) That's why I try to remember the "validate" part of the parameter name. Validation only makes sense when reading from the control, so "true" therefore must be control->variable
0
 
martynjpearsonCommented:
UpdateData takes a BOOL not a bool, so strictly speaking you should pass TRUE or FALSE, rather than true or false.

Call me pedantic....!
Martyn
0
 
Karl Heinz KremerCommented:
martynjpearson, you are pedantic :-) But you are of course right. I do however only use true and false in my code, and (besides the occasional warning) it does not make a difference. I am used to a "real" C++ environment :-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now