Link to home
Start Free TrialLog in
Avatar of tirips
tirips

asked on

listbox.addstring error, why?

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;
}
Avatar of tirips
tirips

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of psdavis
psdavis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks tirips!