如何显示要显示到另一个列表框项目的列表框项目 [英] how to display listbox item to be displayed to another listbox item

查看:101
本文介绍了如何显示要显示到另一个列表框项目的列表框项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c sharp中的列表框开发应用程序。

i有两个列表框。



设计如下;



ListBox1按钮ListBox2



REO

Sco全部添加

Tasco删除

PH2删除所有





当我点击ListBox1中的特定项目时项目将显示在

ListBox2中。





同样当我点击Add All Button所有项目来自ListBox1将显示在ListBox2中。





当我单击要删除的listbox2中的partiuclar项目的Remove Button时。 />


同样当我点击删除全部按钮时,ListBox2中的所有项目都将被移除。



重要的是所有项目从ListBox1中显示数据库。



如何使用c sharp。

解决方案

当然我们不会为你编码。

你应该开始阅读 Windows Forms 和<$上许多可用教程之一(或 CodeProject 文章) c $ c>数据库使用 C#进行编程。


hi,



查看此链接:



http:// www.dotnetperls.com/listbox [ ^ ]

您好b $ b

您可以使用以下代码:



1)从中添加所选项目SourceListBox到TargetListBox



 private void AddButton_Click(object sender,EventArgs e)
{
this.SourceListBox .Items。加入(this.TargetListBox.SelectedItem);
}





2)从ListBox中删除所选项目:



 private void RemoveButton_Click(object sender,EventArgs e)
{
if(this.ListBox.SelectedItem == null)
return;

this.ListBox.Items.Remove(this.ListBox.SelectedItem);
}







3)删除ListBox的所有项目:



 private void RemoveAllButton_Click(object sender,EventArgs e)
{
this.ListBox.Items.Clear();
}





4)从数据库获取数据你可以在下面的链接中看到我对类似问题的回答:



仅从数据库连接列 [ ^ ]



我希望它有用。



..如果它对你有帮助,请接受并放弃投票。


i am developing application using list box in the c sharp.
i have two list box.

Design as follows;

ListBox1 Button ListBox2

REO
Sco Add All
Tasco Remove
PH2 Remove All


when i click the particular item from the ListBox1 that item to be displayed in the
ListBox2.


similarly when i click Add All Button all items from ListBox1 to be displayed in the ListBox2.


when i click the Remove Button that partiuclar item from the listbox2 to be removed.

similarly when i click Remove All Button all items from ListBox2 to be Removed.

Important one is all item from the ListBox1 is displayed from the database.

how to do using c sharp.

解决方案

Of course we won't code it for you.
You should start reading one of the many available tutorials (or CodeProject articles) on Windows Forms and Database programming with C#.


hi,

Check this link :

http://www.dotnetperls.com/listbox[^]


Hi
You can use from bellow code:

1) Add selected Item from SourceListBox to TargetListBox

private void AddButton_Click(object sender, EventArgs e)
{          
        this.SourceListBox .Items.Add(this.TargetListBox.SelectedItem);         
}



2) Remove selected Item from ListBox:

private void RemoveButton_Click(object sender, EventArgs e)
{
        if (this.ListBox.SelectedItem == null)
                return;

        this.ListBox.Items.Remove(this.ListBox.SelectedItem);
}




3) Delete All items of ListBox:

private void RemoveAllButton_Click(object sender, EventArgs e)
{
        this.ListBox.Items.Clear();
}



4) for getting data from Database you can attend to my answer to similar question in bellow link:

Connectivity of only column from database[^]

I hope it's helpful.

..If it's helpful for you please accept it and give Up vote..


这篇关于如何显示要显示到另一个列表框项目的列表框项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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