Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
iam new to vc++. consider i have a dialog box and it contain CombBox.
suppose user typped a new string in ComboBox. After typed a button is clicked. then how to get that typed word from that comb box?
Posted
Comments
[no name] 9-Mar-13 12:26pm    
Very broad and vague. We would have no idea what version C++ you are using (it might make a difference), what platform you are using, what UI framework you are using or what combobox you are trying to get text out of. Quite possibly it's as simple as "yourComboxBox.Text"....

Using MFC (CComboBox) you can easy call CComboBox::GetLBText(), passing it the current selection using CComboBox::GetCurSel()
 
Share this answer
 
Comments
Programmady 9-Mar-13 12:33pm    
iam using VS8. But the above code does'nt work. actually input string is not in selected mode then how it give index? iam using an AutoComplete combo box. so i need typed input from user.
Programmady 9-Mar-13 13:34pm    
thanks for your reply
Quote:
But the above code does'nt work. actually input string is not in selected mode then how it give index? iam using an AutoComplete combo box. so i need typed input from user.

If you need to get text associated with it? then use GetWindowtext().
eg:
C++
CString csText;
m_Combo.GetWindowText( csText );
 
Share this answer
 
Comments
Programmady 9-Mar-13 13:34pm    
thanks for your reply
If you are using MFC, don't forget to do UpdateData() before you try to look at the control's contents.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900