连接列表框项及其值以在MFC VC ++中的文本框中显示 [英] Connecting listbox items and their values to display in text box in MFC VC++

查看:289
本文介绍了连接列表框项及其值以在MFC VC ++中的文本框中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图链接列表框和特定应用程序的编辑框,

如果我在列表框中选择一些项目,其相应的值应显示在文本框中并允许修改..



请帮帮我

Im trying to link list box and the edit box for a particular application,
If i select some item in the list box, its corresponding value should be displayed in the text box and allow to modify..

Please Help me out

推荐答案

添加LBN_SELCHANGE [ ^ ]对话框类的处理程序,用新选择的项目更新编辑控件:

Add an LBN_SELCHANGE[^] handler to your dialog class that updates the edit control with the newly selected item:
CMyDialog::OnSelChange()
{
    int nSel = m_ListBox.GetCurSel();
    if (nSel != LB_ERR)
    {
        CString strText;
        m_ListBox.GetText(nSel, strText);
        m_EditBox.SetWindowText(strText);
    }
}


这篇关于连接列表框项及其值以在MFC VC ++中的文本框中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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