Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get user entered text from a CComboBox

Status
Not open for further replies.

jdeejay

Programmer
Oct 5, 2001
44
US
How do I get the string that a user types in a CComboBox (not one of the pre-defined choices)? Also, how do I set it so that when the dialog opens, the user can just begin typing in the combobox instead of clicking there first.

Thanks in advance
 
I think to get the text you can do this:

-------
CWnd* theCombo = GetDlgItem(IDC_COMBO1);
CString cboString;
theCombo->GetWindowText(cboString);
//Set Focus to combo
theCombo->SetFocus();
-------

You can also set the combo box's tab order to the front to avoid the SetFocus call.

HTH!

~Mike


Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top