Solved

CComboBox

Posted on 1998-04-03
1
660 Views
Last Modified: 2013-11-20
In my Document Class, I create an object of class CList_Dlg(class I derived from CDialog).  Within
this dialog, i have a combobox.  Using ClassWizard, I created two member variables for
the ComboBox, one a CString - the other a CComboBox.   My question is Before I call "dlg.DoModal()", I want
to fill this combobox up with a bunch of strings.   Please also assume It is necessary to do this inside the DOC class and not inside the CList_DLG class.  If I call any member function of the ComboBox variable, such as
Dir, AddString, InitStorage...i crash.  Yet, If I simply assign a value to the CString variable it works, and adds it
the selectbox inside the combobox.  Why is this?  Second, Is there a way to fillup the combobox inside my doc class?

Thanks in advance.
0
Comment
Question by:smithc
1 Comment
 
LVL 7

Accepted Solution

by:
galkin earned 30 total points
ID: 1317445
When you create modal dialog with Domodal you enter message loop. Before calling DoModal dialog and its child controls do not exist YET, when DoModal returns as a result of user's closing dialog by any way dialog window and its child controls do not exist ALREADY. So attemping to access dialog or any control before or after DoModal results in crash. The only one way is to override dialog OnInitDialog function and initialize controls from there. If you need to get data from document class you can add pointer to this document to dialog constructor and store this pointer to dialog member variable
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

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 109
sum28 challenge 31 105
haveThree challenge 22 114
Trying to run powershell  in a batch file. How do I do this? 8 65
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

16 Experts available now in Live!

Get 1:1 Help Now