Solved

UpdateData(false) in a editbox

Posted on 2004-04-15
6
844 Views
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.

0
Comment
Question by:dkloeck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:bkfirebird
ID: 10838005
try m_BildCtrl.UpdateData (TRUE)
0
 
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:
m_BildCtrl.UpdateData(false);
0
 
LVL 4

Accepted Solution

by:
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)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
0
 
LVL 8

Expert Comment

by:martynjpearson
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....!
Martyn
0
 
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 :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

626 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