Wednesday, May 12, 2010

How to pass a text value from listbox control to another listbox control in windows application using c#?

I would imagine you would want to pass the currently selected item to the other listbox, if that is the case then something like this:





yahoo messes up the code so just put this all on 1 line





listBox2.Items.Add(


listBox1.SelectedItem);How to pass a text value from listbox control to another listbox control in windows application using c#?
why u want do this????





it is a great question!!!








if your listboxes are connected to a database (a filed from a table)


u can INSERT that text to related table and referesh the second list box;





but if that's not connected to a database, u can add that text as a ListBox.Item then add that Item to your listBox





another thing!!!!


I think so u can use any class instead of ListBox, like CheckListBox that allow you check an item after adding to the CheckListBox;


Because u may need check them after transformation to the second list box!








Good Luck














.

No comments:

Post a Comment