Solved

How to preload dialog fields

Posted on 2010-09-15
3
407 Views
Last Modified: 2013-12-14
Hi,

I am writing an mfc based visual c++ application (Visual Studio 2008) and I am having some
difficulties with configuring a modal dialog box.

The dialog box is intended to configure database access parameters - database name,
password etc.

Problem is that I can't figure out how to preload the fields on dialog box creation
ie I need to read some data from the registry, and populate the fields.

Any suggestion for this would be appreciated.  I've tried a number of methods including overloading OnInitialUpdate, but no success.

Thanks

Chris

0
Comment
Question by:chrisd-r
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 33680549
Hi chrisd-r,

best place to do this is in an overloaded 'OnInitDialog' (which you can easy add via ClassWizard by adding a message handler for WM_INIT_DIALOG message) somehow like this:

> BOOL CMyDlg::OnInitDialog()
> {
>  CDialog::OnInitDialog();
>  // load your values here and fill the controls
>  UpdateData( FALSE ); // This is needed if you use DDX-Data exchange using variables for controls
> }

Hope that helps,

ZOPPO
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 33680562
Here you can find samples for some different ways to init the values of an edit control: http://functionx.com/visualc/controls/editbox.htm
0
 

Author Comment

by:chrisd-r
ID: 33680641
Thanks for the help - It is now fixed.

Forgot to call UpdateData(FALSE);

Chris
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

914 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

21 Experts available now in Live!

Get 1:1 Help Now