About ComboBox

Hello, I'm newbie at VC++ and have a litttle problem.
I need to read a file (text file) in order to initialize some dialog boxes. I have no problem with Edit boxes, but Combo Boxes are another thing.
This is part of my code:

FichProyecto.ReadString(linea);
campo=linea.SpanExcluding(":");
tam=linea.GetLength()-campo.GetLength()-2;

if (campo=="paridad")
{
      CComboBox* combo;
      combo=(CComboBox*)m_pCanalSerieDlg->GetDlgItem(IDC_COMBO_PARIDAD);
       combo->SelectString(-1, linea.Right(tam));
}

m_pCanalSerieDlg is a pointer to the dialog box that contains the combo box.

There is no compilation problems, but execution problems.
What am I doing wrong??
Thx.
amkharaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wildyCommented:
What type of problems do you have?
0
amkharaAuthor Commented:
"A debug assertion failed."

It seems to be at

CWnd* CWnd::GetDlgItem(int nID) const
{
      ASSERT(::IsWindow(m_hWnd));

      if (m_pCtrlCont == NULL)
                               // here is the problem
            return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID));
      else
            return m_pCtrlCont->GetDlgItem(nID);
}

And the program crashes.

0
Shay050799Commented:
where is this function take place ?
OnInitDialog ?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

amkharaAuthor Commented:
No... in OnOpenFile I call a function "LeerFich" to read the file. The code I posted belongs to this function "LeerFich".
0
wildyCommented:
If the dialog is not created when you call GetDlgItem, it crashes...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
amkharaAuthor Commented:
OK. Then I'll have to keep the value and then, when I create the dialog, use it, isn't it??

Thx
0
wildyCommented:
You are right.
0
amkharaAuthor Commented:
OK... Thx a lot
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.