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)
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 94
Smart Camera scanning and reading information 3 86
EvenOdd challenge 10 83
MaxSpan challenge 9 67
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now