C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Add/remove items from one listbox to other (in C#)


Posted Date: 03 Jun 2008    Resource Type: Code Snippets    Category: Collections
Author: Debasmit SamalMember Level: Gold    
Rating: Points: 8



Code Adds the selected items from one listbox to other also You can remove transfered items from other listbox.

public void Page_Load()
{
if (!ispostback) {
state.items.add(new listitem("California", "CA"));
state.items.add(new listitem("Georgia", "GA"));
state.items.add(new listitem("New York", "NY"));
state.items.add(new listitem("Maxico", "MX"));
state.items.add(new listitem("San Fransisco", "SF"));
}
}

public void disp(object s, commandeventargs e)
{
int i;
if (e.commandname == "add") {
statevalue.items.clear();
for (i = 0; i <= state.items.count - 1; i++) {
if (state.items(i).selected) {
statevalue.items.add(state.items(i).text);
}
}
}
else if (statevalue.selectedindex > -1) {
for (i = statevalue.items.count - 1; i >= 0; i += -1) {
if (statevalue.items(i).selected) {
statevalue.items.remove(statevalue.items(i).text);
}
}
}
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to Invoke Unmanaged DLL Functions from Compact Framework for Pocket PC
Previous Resource: How to get the Assembly Version of an executable file for Emulators in PocketPC Device Emulators
Return to Discussion Resource Index
Post New Resource
Category: Collections


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use