How to get the value (string) of the current selection in a combobox
mfcvisual-c++visual-c++-6
How can I get the value (string) of the current selection in a combobox?
(Not the integer index)
Best Solution
There might be a better way (my MFC is a bit rusty), but it seems like you should be able to call CComboBox::GetLBText(), passing it the current selection using CComboBox::GetCurSel().
Here 50 in SetItemHeight Indicates the y-Coordinates which in our term is referred as height now .After adding the above code snippet in the OnInitDialog(), the combobox looks like (refer original post where I added the image of the combobox control after increasing the height(Image 2)).
Best Solution
There might be a better way (my MFC is a bit rusty), but it seems like you should be able to call
CComboBox::GetLBText()
, passing it the current selection usingCComboBox::GetCurSel()
.