无法从ComboBox获取第一个值

编程入门 行业动态 更新时间:2024-10-13 02:14:53
本文介绍了无法从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获取第一个值

本文发布于:2023-11-22 06:15:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616285.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第一个   ComboBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!