UpdateData(false) in a editbox

Posted on 2004-04-15
Last Modified: 2013-11-20
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.

Question by:dkloeck
  • 3
  • 2

Expert Comment

ID: 10838005
try m_BildCtrl.UpdateData (TRUE)
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10838105
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:

Accepted Solution

bkfirebird earned 30 total points
ID: 10838253
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)
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10838336
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

Expert Comment

ID: 10839816
UpdateData takes a BOOL not a bool, so strictly speaking you should pass TRUE or FALSE, rather than true or false.

Call me pedantic....!
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10840643
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 :-)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 94
sameEnds challenge 3 179
dog bark java program 15 105
if loop in java 3 151
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question