先是初始化:
CComboBox m_Comline;
CString str;
for(int i=1;i <=10;i++)
{
str.Format("%d",i);
m_Comline.AddString(str);
}
但是利用ON_CBN_SELCHANGE事件后,怎么获得选中的值并转换为int类型?谢谢!!
CComboBox m_Comline;
CString str;
for(int i=1;i <=10;i++)
{
str.Format("%d",i);
m_Comline.AddString(str);
}
但是利用ON_CBN_SELCHANGE事件后,怎么获得选中的值并转换为int类型?谢谢!!
m_Comline;
CString str;
m_Comline.GetWindowText(str);
int iVal = atoi(str);
int iVal = atoi(str);
int nIndex = m_Combo.GetCurSel();
if(nIndex != CB_ERR)
{
CString m_str ;
m_Combo.GetLBText(nIndex , m_str);
}获取当前选择的项
int i = atoi(m_str);//转化为整型
m_Comline.GetLBText(m_Comline.GetCurSel(), str);
int i = atoi(str);
连引用的人都给分,看5楼:http://topic.csdn.net/u/20091214/12/ce864d61-4bf9-4e6d-a314-4e3047675172.html