I'm looking for a bit of advice before I try to do something.
I need to replicate the sort of form you get in MSAccess where you are selecting the fields you want in a query.
There are two boxes - one on the left and one on the right and, between them, 4 buttons that allow you to:
select one item from the box on the left and move it to the box on the right
select all items from the box on the left and move to the right
select one item from the right and move to the left
select all items from the right and move to the left
Which controls should I use?
Two rich text boxes?
Is there a built-in control in VB for this?
I want users to be able to shift-click and control-click in either box to select items that are not necessarily next to each other etc.
Appreciate any input on the best way to implement this.
Thanks in advance.
Last edited by Webskater; May 1st, 2007 at 08:31 AM.
Reason: Missed something out
1.Use two list boxes and 4 buttons
2.Set the multiselect property of both
3.Try this code for moving selected items from list1 to list2
Code:
Private Sub Command1_Click()
For i = 0 To List1.ListCount - 1
If List1.List(i) = "" Then Exit For
If List1.Selected(i) = True Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next
End Sub
I've use this type of thing in projects beyond count, including the one I'm currently working on.
Do you have any other questions on this topic?
Well ... since you ask ... what do you do if you want to retrieve an ID associated with each item. If Oranges are 7 and Apples are 4 etc and what you want to be able to access is those values?
Thanks again. (Blast - already marked thread as resolved!)
The list on the left contains a list of products that users can click on to compare them.
So, when the list on the right is populated - they will click a 'Compare' button and I will pass the list of ProductIDs (hidden) in the list to retrieve the details from the database.
Let's say the user decides to compare oranges, apples, pears and peaches. I'll be passing say 4,7,9,13 (the ProductIDs) as the parameters to a SQL statement to return various fields which I will then put into an excel spreadsheet for the user to import into their own reporting tool.
How are they laid out with respect to productIDs, products and product details?
Are you using just one table for all of this or are there multiple tables involved?
(Incidentially, until we get this worked out, edit the first post and backspace RESOLVED out of the thread title, then scroll down to the icon section and click No Icon - you can click the Mark Thread Resolved again later on.)