无法从ComboBox获取第一个值 [英] cannot get the first vallue from ComboBox

查看:122
本文介绍了无法从ComboBox获取第一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生,
组合框中有一些数据,
首先,如果我从ComboDropDown中选择任何数据.
该值以空"形式出现
第二次,如果我选择和数据,它将显示值
任何想法,供您参考,这里是代码

Hi sir,
I have some data in combo box,
First if i select any data from ComboDropDown.
The value is coming as "empty"
Second time if i select and data ,its displaying the value
Any idea,For your information,here is the code

void CTest1View::OnSelchangeCombo1() 
{
	CString SelectedOption;		
	m_ctrlCombo.GetWindowText(SelectedOption); // First time the value is empty	
        AfxMessageBox(SelectedOption);
	
}


例如:
ComboBox包含值"A","B","C".
如果是第一",则从ComboBox中选择任何值,即A,B或C
它显示为空,第二次工作正常.
我做错什么了吗

谢谢
Raj


For Example :
ComboBox Contains values "A","B","C".
If First i select any value from ComboBox i.e either A,B or C
Its showing empty,second time its working fine.
Am i doing anything wrong

Thanks
Raj

推荐答案

表单CComboBox文档[ ^ ]:
Form CComboBox documentation [^]:

ON_CBN_SELCHANGE由于用户单击列表框或使用箭头键更改选择,结果将更改组合框列表框中的选择.处理此消息时,只能通过 GetLBText 或其他类似函数来检索组合框的编辑控件中的文本. GetWindowText 不能使用.

ON_CBN_SELCHANGE The selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. When processing this message, the text in the edit control of the combo box can only be retrieved via GetLBText or another similar function. GetWindowText cannot be used.



:)



:)


这篇关于无法从ComboBox获取第一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆