vc 我想把 单位编号 单位名称 存在 下拉列表中 选择单位名称 也能得到 单位编号
在别的语言中如 下拉列表.value =单位编号 下拉列表.txt=名称
怎么办了,希望有个完整的例子
在别的语言中如 下拉列表.value =单位编号 下拉列表.txt=名称
怎么办了,希望有个完整的例子
解决方案 »
- 如何将0x123456变成0xFF123456??
- MFC基于CFormView的视图不能分割成两部分么?
- long int是多少位,这个是C语言决定的,还是OS位数决定的,还是编译器自己决定的?
- 保存功能
- 关于界面的问题
- 为什么用Office 2000的Access用Ado访问,提示不识别?怎么才能让他识别??
- 关于ole文档的问题,急!!!
- 有关activeX web broswer的问题
- 添加右键菜单后程序会很卡的问题
- 谁能告诉我以下代码那里出错为什么,如何改?
- VS2005里面怎么重载菜单打开命令
- 请问VC2008下的 1.通过"项目->属性->链接器->输入->附加依赖项"添加静态库,2.工具->选项->项目个解决方案->VC++目录 下添加静态库,2者是一样的吗?
然后,用:ON_CBN_SELCHANGE中,选择变化的时候,同时通知另外一个变化,只要SetCurSel(index)来设置另外一个当前的选择,就能保持一致;
取值的话,只要根据INDEX取,就一致了!
==========================================
CComboBox::SetItemData
int SetItemData( int nIndex, DWORD dwItemData );Return ValueCB_ERR if an error occurs.ParametersnIndexContains a zero-based index to the item to set.dwItemDataContains the new value to associate with the item.ResSets the 32-bit value associated with the specified item in a combo box. Use the SetItemDataPtr member function if the 32-bit item is to be a pointer.Example// The pointer to my combo box.
extern CComboBox* pmyComboBox;// Set the data of each item to be equal to its index.
for (int i=0;i < pmyComboBox->GetCount();i++)
{
pmyComboBox->SetItemData(i, i);
}===============================
CComboBox::GetItemData
DWORD GetItemData( int nIndex ) const;Return ValueThe 32-bit value associated with the item, or CB_ERR if an error occurs.ParametersnIndexContains the zero-based index of an item in the combo box’s list box.ResRetrieves the application-supplied 32-bit value associated with the specified combo-box item. The 32-bit value can be set with the dwItemData parameter of a SetItemData member function call. Use the GetItemDataPtr member function if the 32-bit value to be retrieved is a pointer (void*).Example// The pointer to my combo box.
extern CComboBox* pmyComboBox;// If any item's data is equal to zero then reset it to -1.
for (int i=0;i < pmyComboBox->GetCount();i++)
{
if (pmyComboBox->GetItemData(i) == 0)
{
pmyComboBox->SetItemData(i, (DWORD) -1);
}
}