在列表框1中选择的项目转到列表框2然后立即列出框1选中的项目启用我该怎么办 [英] in list box 1 selected item goes to list box 2 then immediately list box 1 selected item is enabled how can i do

查看:63
本文介绍了在列表框1中选择的项目转到列表框2然后立即列出框1选中的项目启用我该怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在列表框中1选中的项目转到列表框2然后立即列出框1所选项目已启用我该怎么办。







i在我的项目中有两个列表框。我有两个按钮,如下添加和加载。



当我点击加载按钮时,所有的教师代码都从数据库中检索出来并显示在工作的列表框1中很好。







当我选择时,列表框1选中项目并单击添加按钮选定的教师代码转到列表框2工作。



我需要的是列表框1当我单击添加按钮然后立即选择项目进入列表框2选中的列表框1项目将被启用为假。



我该怎么办。帮助我。

解决方案

如果您只是想取消选择它:



 listBox1.SelectedIndex = -1; 





如果你还想删除它:



 listBox1.Items.Remove (listBox1.SelectedItem); 


in list box 1 selected item goes to list box 2 then immediately list box 1 selected item is enabled how can i do.



i have two list box in my project. i have two buttons as follows add and load.

when i click the load button all faculty code is retrieved from the DB and displayed in the list box 1 that is working fine.



when i select, the list box 1 selected item and click the add button that selected faculty code goes to list box 2 that is working .

what i required is list box 1 selected item goes to list box 2 when i click the add button then immediately the selected list box 1 item is to be enabled false.

how can i do.help me.

解决方案

If you just want to deselect it:

listBox1.SelectedIndex=-1;



If you also want to delete that:

listBox1.Items.Remove(listBox1.SelectedItem);


这篇关于在列表框1中选择的项目转到列表框2然后立即列出框1选中的项目启用我该怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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