moving data between 2 listbox

svibuk

Active member
Joined
Jul 15, 2008
Messages
31
Programming Experience
1-3
i am using vs2005 and vb.net windows application
i have 2 listtbox
listbox1 populated with data from sqlserver using dataadapter
on a command button click i want to move the selected data from listbox1 to listbox2 (multiselect) & vicversa

i am able to do it using javascrpt but want to do it using vb.net code
culd anybody help me in coding
 
it's not hard, but you need to understand that listboxes themselves do not contain data. I did this once for someone else here but I cannot find the project now

The basics were:

Both listboxes bind to a datatable what has a column "ShowInListbox" and a value of 1, or 2. Both listboxes bind through a different bindingsource and the .filter property of each bindsource is set such that listbox1's BS has filter = "[ShowInListbox] = 1" and listbox2 has a filter of 2, respectively

Now to "Move" data between each listbox, you simply set the value of "ShowInCOlumn" to be 1 or 2 respectively
 

Latest posts

Back
Top