?
Solved

How to preload dialog fields

Posted on 2010-09-15
3
Medium Priority
?
463 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 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

850 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