Solved

Can't get combobox to work (Visual C++ 6)

Posted on 2004-04-20
3
1,325 Views
Last Modified: 2008-01-09
Hi,

All I'm trying to do is get my combobox (id IDC_COMBO1) to display stuff at runtime.

In OnInitDialog I've got
CComboBox* pcmb = (CComboBox*)GetDlgItem(IDC_COMBO1);
pcmb->AddString("ABC");

Is this right? If so, why doesn't it work? I also tryed just writing some stuff in the data section of the combobox properties, but that didn't work either. It's a Drop List, but nothing happens when I run it and click on the arrow. I also tried creating a CComboBox variable in the ClassWizard, but couldn't get this to work either.

I'm sure it's something extremely simple, but I haven't used a combobox before,

Thanks
0
Comment
Question by:shifty_mc
[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
3 Comments
 
LVL 3

Accepted Solution

by:
akalmani earned 55 total points
ID: 10867938
1) In the resource editor check the combobox properties, see if visible is checked.
2) In the resource editor click on the combo box droplist arrow (down arrow) and see if the height is ok. I mean increase the height of the data area of combo box.
3) Check whether the ID of the combo box is right?

You can as well statically add some data in the resource editor. Just click of the data and add values. If you need more than 1 just press Ctrl+Enter instead of just enter.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 10867959
That should work, but maybe you have to call

    UpdateData(FALSE)

to invoke a screen refresh.

If you still see nothing in the box,  most likely the ID is wrong or you have two comboboxes one hiding the other.

You may post the dialog header file, the OnInitDialog function and the .rc file then.

Regards, Alex
0
 

Author Comment

by:shifty_mc
ID: 10868068
Ah, it was just the height thing - thank you very much. I knew I was doing the code right, but I didn't know about the data area height and didn't come across it in any of my searches,

Thanks again.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

635 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