Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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#.
 
Share this answer
 
hi,

Check this link :

http://www.dotnetperls.com/listbox[^]
 
Share this answer
 
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..
 
Share this answer
 
Please find this one C# listbox operations hope this will help you.

douglas
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900