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:


if (campo=="paridad")
      CComboBox* combo;
       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??
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.

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

It seems to be at

CWnd* CWnd::GetDlgItem(int nID) const

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

And the program crashes.

where is this function take place ?
OnInitDialog ?
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".
If the dialog is not created when you call GetDlgItem, it crashes...

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??

You are right.
amkharaAuthor Commented:
OK... Thx a lot
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

From novice to tech pro — start learning today.