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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write into combobox

Status
Not open for further replies.

nanzp

Programmer
Feb 24, 2000
10
IE
Hi all,<br>
I am using a combo-box in a dialog-box where the user selects Insert mode, Update mode or View mode. If the user selects Insert mode I want them to be able to write into the combo-box rather than selecting from it.<br>
Does anyone know the code to get the text that the user types into the combo-box.<br>
I cannot see how an index is assigned to the new item that the user types in.<br>
Thanks in advance,<br>
Ann
 
Hi Ann (again!)<br>
<br>
Remember that a combo box is really two controls in one -- a list control where users select stuff, and an edit box where they can type into.<br>
<br>
So if you want to see what they've selected as they select it, look for the CBN_SELCHANGE message. To see what the user has typed as they type it into the edit portion, look for the CBN_EDITUPDATE message (this msg occurs before it gets displayed on the screen, so you can tweak it if you want to, like force it to uppercase, etc.).<br>
<br>
The standard way to get the contents of the combobox is to send it a WM_GETTEXT message. To find which item in the list has been selected, send a CB_GETCURSEL.<br>
<br>
I've approached this from the viewpoint of a Win32 API developer. If you're using a layer such as MFC, things will obviously be different than what I've said here. :-(<br>
<br>
Chip H.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top