【问题标题】:How to transfer one item from one listbox to another in Visual C++ .net如何在 Visual C++ .net 中将一项从一个列表框传输到另一个列表框
【发布时间】:2011-11-09 11:43:40
【问题描述】:

我想将一个项目从一个列表框转移到另一个列表框,并能够删除它。我也希望能够将一个项目多次添加到另一个列表框。这是我的意思的屏幕截图。

【问题讨论】:

    标签: .net c++ visual-c++ listbox dialog


    【解决方案1】:

    你可以这样做:

    Button ">" 事件处理程序:

     if (this->leftListBoxName->SelectedItem != nullptr)
        this->rightListBoxName->Items->Add(this->leftListBoxName->SelectedItem);
    

    和按钮“

    if (this->rightListBoxName->SelectedItem != nullptr)
                this->rightListBoxName->Items->RemoveAt(this->rightListBoxName->SelectedIndex);
    

    【讨论】:

    • 这很奇怪。您能否将 Form1.h 文件的整个代码粘贴到 pastebin.com(或其他 paste* 网络服务)?
    • 对不起,这是我的错。我把列表框命名错了,谢谢你的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 1970-01-01
    • 2020-07-29
    • 1970-01-01
    相关资源
    最近更新 更多