Solved

CComboBox

Posted on 1998-04-03
1
669 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
[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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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