<i id='pg1gu'><tr id='pg1gu'><dt id='pg1gu'><q id='pg1gu'><span id='pg1gu'><b id='pg1gu'><form id='pg1gu'><ins id='pg1gu'></ins><ul id='pg1gu'></ul><sub id='pg1gu'></sub></form><legend id='pg1gu'></legend><bdo id='pg1gu'><pre id='pg1gu'><center id='pg1gu'></center></pre></bdo></b><th id='pg1gu'></th></span></q></dt></tr></i><div id='pg1gu'><tfoot id='pg1gu'></tfoot><dl id='pg1gu'><fieldset id='pg1gu'></fieldset></dl></div>
    • <bdo id='pg1gu'></bdo><ul id='pg1gu'></ul>

      <legend id='pg1gu'><style id='pg1gu'><dir id='pg1gu'><q id='pg1gu'></q></dir></style></legend>

    1. <small id='pg1gu'></small><noframes id='pg1gu'>

      1. <tfoot id='pg1gu'></tfoot>
      2. 将项目从一个列表框移动到另一个

        Move items from one listbox to another(将项目从一个列表框移动到另一个)

            <bdo id='79eEu'></bdo><ul id='79eEu'></ul>
            <i id='79eEu'><tr id='79eEu'><dt id='79eEu'><q id='79eEu'><span id='79eEu'><b id='79eEu'><form id='79eEu'><ins id='79eEu'></ins><ul id='79eEu'></ul><sub id='79eEu'></sub></form><legend id='79eEu'></legend><bdo id='79eEu'><pre id='79eEu'><center id='79eEu'></center></pre></bdo></b><th id='79eEu'></th></span></q></dt></tr></i><div id='79eEu'><tfoot id='79eEu'></tfoot><dl id='79eEu'><fieldset id='79eEu'></fieldset></dl></div>
            1. <legend id='79eEu'><style id='79eEu'><dir id='79eEu'><q id='79eEu'></q></dir></style></legend>
                • <small id='79eEu'></small><noframes id='79eEu'>

                  <tfoot id='79eEu'></tfoot>

                    <tbody id='79eEu'></tbody>
                  本文介绍了将项目从一个列表框移动到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将项目从一个列表视图移动到另一个.将它们添加到第二个有效,但移动的条目根本不会被删除.

                  I'd like to move items from one list view to another. adding them to the second one works but the moved entries don't get removed at all.

                  private void MoveSelItems(ListBox from, ListBox to)
                      {
                          for (int i = 0; i < from.SelectedItems.Count; i++)
                          {
                              to.Items.Add(from.SelectedItems[i].ToString());
                          }
                  
                          from.Items.Remove(to.SelectedItem);
                      }
                  

                  我正在使用 C#/Winforms/-NET 3.5

                  I'm using C# / Winforms / -NET 3.5

                  推荐答案

                  在循环结束时试试这个代码

                  Try this code instead at the end of the loop

                  foreach ( var item in new ArrayList(from.SelectedItems) ) {
                    from.Items.Remove(item);
                  }
                  

                  这篇关于将项目从一个列表框移动到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                    <tbody id='bQc9p'></tbody>

                        <small id='bQc9p'></small><noframes id='bQc9p'>

                          <bdo id='bQc9p'></bdo><ul id='bQc9p'></ul>
                          <i id='bQc9p'><tr id='bQc9p'><dt id='bQc9p'><q id='bQc9p'><span id='bQc9p'><b id='bQc9p'><form id='bQc9p'><ins id='bQc9p'></ins><ul id='bQc9p'></ul><sub id='bQc9p'></sub></form><legend id='bQc9p'></legend><bdo id='bQc9p'><pre id='bQc9p'><center id='bQc9p'></center></pre></bdo></b><th id='bQc9p'></th></span></q></dt></tr></i><div id='bQc9p'><tfoot id='bQc9p'></tfoot><dl id='bQc9p'><fieldset id='bQc9p'></fieldset></dl></div>
                        • <legend id='bQc9p'><style id='bQc9p'><dir id='bQc9p'><q id='bQc9p'></q></dir></style></legend>
                          1. <tfoot id='bQc9p'></tfoot>