列表框:如何在C#中移动多个项目? [英] List Box : how to move multiple items in C# ?

查看:74
本文介绍了列表框:如何在C#中移动多个项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在尝试将多个项目从一个列表框移动到另一个列表框,我尝试了以下代码,但到目前为止输出只是给了我{collection }"在另一个列表框中。

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

解决方案

您遍历所选项目的集合并显示一个一个....基本上你有收集而不是个别项目...


问候

Dheeraj Joshi


尝试以下代码,希望它会起作用。 Actaually ListBox Control有一个名为SelectedIndexChange()的事件,为了触发它,我使用了另一个Button,但在eventhandler中没有写任何内容,因为Page_Load()方法是!IsPostback。因此,当您在第一个ListBox1中选择State并单击Button时,第二个ListBox2将从第一个中获取值。

展开 | 选择 | Wrap | 行号

嘿sanjib65,


您没有将物品从一个列表框移动到其他列表....


当所选项目的属性发生更改时,会发生所选索引更改你是如何解决这个问题的?


问候

Dheeraj Joshi


Hello,

I am trying to move multiple items from one list box to another, i have tried the following code, but the output so far just gives me "{collection}" in the other list box.

Expand|Select|Wrap|Line Numbers

解决方案

You iterate through the collection of selected items and display one by one.... Basically you have the collection not individual items...

Regards
Dheeraj Joshi


Try the followng code, hopefully it will work. Actaually ListBox Control has an event called SelectedIndexChange(), to fire it I have used another Button but wrote nothing in its eventhandler because the Page_Load() method is !IsPostback. So when you select State in the first ListBox1, and click the Button, the second ListBox2 will take the value from the first one.

Expand|Select|Wrap|Line Numbers


Hey sanjib65,

You are not moving the items from one list box to other....

Selected index changed occurs when property of selected item changes. How you are relating this to the problem?

Regards
Dheeraj Joshi


这篇关于列表框:如何在C#中移动多个项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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