Solved

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

Posted on 2004-04-20
3
1,318 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Implementing a ResolveEventHandler in C++ 13 133
FMX enumerated colours 2 100
How to convert MFC::CString to UTF8 wchar_t* 10 211
Arduino EDI - Programming language 3 94
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

810 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