Click here to Skip to main content
11,647,827 members (60,651 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 5-Jan-13 2:49am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Of course we won't code it for you.
You should start reading one of the many available tutorials (or CodeProject articles) onWindows Forms and Database programming with C#.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

hi,

Check this link :

http://www.dotnetperls.com/listbox[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Please find this one C# listbox operations hope this will help you.

douglas
  Permalink  

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

  Print Answers RSS
0 jyo.net 500
1 F-ES Sitecore 410
2 DamithSL 290
3 CPallini 290
4 OriginalGriff 277
0 OriginalGriff 1,342
1 jyo.net 994
2 DamithSL 971
3 Sergey Alexandrovich Kryukov 873
4 CPallini 845


Advertise | Privacy | Mobile
Web04 | 2.8.150804.4 | Last Updated 19 Dec 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100