?
Solved

How to preload dialog fields

Posted on 2010-09-15
3
Medium Priority
?
445 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
[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
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
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…

762 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