Solved

listbox.addstring error, why?

Posted on 1998-07-14
3
201 Views
Last Modified: 2013-11-20
all i'm trying to do was use a dialog box to ask what to open an unknown file type as, and i'm fairly sure it is the add string that is doing it. when i comment them out (making it pointless) it works fine, minus the text.

if ((type != typeA) | (type != typeB) | (type != typeC))
{
COpenAs dlg;  // a dialog box with a list box and an ok and cancel button
               // and used the class wiz to link CListBox m_File_Type to
               // the dialog box list box no other noteable changes made
dlg.m_File_Type.AddString("Type A");  // *******puts error here
dlg.m_File_Type.AddString("Type B");
dlg.m_File_Type.AddString("Type C");
dlg.m_File_Type.SetCurSel(0);
if (dlg.DoModal() == IDOK)
  if (dlg.m_File_Type.GetCurSel() != LB_ERR)
    type = dlg.m_File_Type.GetCurSel() + 1;
}
0
Comment
Question by:tirips
  • 2
3 Comments
 

Author Comment

by:tirips
ID: 1319127
Edited text of question
0
 
LVL 7

Accepted Solution

by:
psdavis earned 50 total points
ID: 1319128
At this point, the listbox isn't created.  Override the WM_INITDIALOG and put the add strings in there.

Phillip

0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319129
Thanks tirips!
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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

863 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

28 Experts available now in Live!

Get 1:1 Help Now