PDA

View Full Version : transferring selections from one list box to another



mtechserv
10-20-2009, 07:23 PM
I'm working on a program that will be used to facilitate the creation of packlists.

Part of the pack list creation involves selecting items from one listbox (named "dnlistbox") selecting an "Insert" button (just a simple command button) which transfers the selection to another listbox ("skidlistbox").

The "dnlistbox" is a two column list box that is populated with an array. One column in the list box is part numbers, and the second column in the list box is the corresponding item size for that part number. As the user makes a selection in "dnlistbox" and selects "insert", I want both columns of that selection to be inserted into "skidlistbox".
"Skidlistbox" starts out as an empty listbox.

It sounds simple enough, but I can't get the data to show up properly in the "skidlistbox". I've tried countless combinations of list, additem, boundcolumn, etc. but I always end up with the part number from the first column of "dnlistbox" in both columns of "skidlistbox".

There's probably a very easy solution to this. Can someone point me in the correct direction.


Thanks
Brian

geekgirlau
10-20-2009, 08:52 PM
You use AddItem to insert a new row and set the value for column 1, then List to add the value in column 2.


With Me.Skidlistbox
.AddItem Me.dnlistbox.List(Me.dnlistbox.ListIndex, 0)
.List(.ListCount - 1, 1) = Me.dnlistbox.List(Me.dnlistbox.ListIndex, 1)
End With