[VB.NET] Best way of doing this?

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

I have 5 drop down boxes all with the same 10 items in them.

What i want to happen is that when you select one of the items in one of the drop down boxes, it doesn't have it on the list of the other drop down boxes. And if you select something else tehn the thing you selected first time in in the lists and the thing that is currently selected isn't there.

And this is the same for all the drop down boxes.

Thanks.
 
First to answer why:

Cause i need to be able to refer to the value in each combo box so i can assign it a value based on whats selected in another combo box by it.

With check boxes i can't do that and make it user friendly.

I see what you are getting at with the collection thing and will give that a go
 
TrUz said:

Tried this and because after you have reconstructed the list, you have to set the selected values of the drop down boxes that were already selected it goes in a loop and doesn't stop.

How do i avoid this.

Edit:

I think i see what you have to do. Some kind of Latch
 
Last edited:
Hi there,

Thanks for your reply, I have done what i originally wanted (thanks to your help).

Basically i have five sets of two drop box boxes and they are linked to each other.

So tha value selected on the left will be assigned to the value on the right.

Maybe this diagram will help:

3b88bfa030_Untitled1png.png


If I did it with a drop down check box, it wouldnt have the same effect. Because I and the user will need to know what is linked to what

I would prefer to do it so it updates the lists rather than any validating.

Thanks for your help!!!
 
New Question

Basically,

I have my five drop down boxes with the values in them.

I need to work out every possible combination (sum of the drop down boxes) and add it to a list.

First part would be:

1
2
3
4
5

Second Part:

1,2
1,3
1,4
1,5
2,3
2,4
2,5
3,4
3,5
4,5

Third Part:

1,2,3
1,2,4
1,2,5
1,3,4
1,3,5
1,4,5
2,3,4
2,3,5
2,4,5
3,4,5

Fourth Part:

1,2,3,4
1,2,3,5
1,2,4,5
1,3,4,5
2,3,4,5

Fifth Part:

1,2,3,4,5

Total Number of Combitionations:

31 (if my maths is correcT)

key:

1 = Drop Down Box 1
2 = Drop Down Box 2
3 = Drop Down Box 3
4 = Drop Down Box 4
5 = Drop Down Box 5

Is there a more efficient way than manually typing every combination?

Thanks
 
Last edited:
Further expalination:

Basically I want to shorten this, is there a way?

Code:
        Dim d1, d2, d3, d4, d5 As Integer
        Dim sComb As List(Of Integer)

        d1 = Val(S1.SelectedItem)
        d2 = Val(S2.SelectedItem)
        d3 = Val(S3.SelectedItem)
        d4 = Val(S4.SelectedItem)
        d5 = Val(S5.SelectedItem)
            
        sComb.Add(d1)
        sComb.Add(d2)
        sComb.Add(d3)
        sComb.Add(d4)
        sComb.Add(d5)
        sComb.Add(d1 + d2)
        sComb.Add(d1 + d3)
        sComb.Add(d1 + d4)
        sComb.Add(d1 + d5)
        sComb.Add(d2 + d3)
        sComb.Add(d2 + d4)
        sComb.Add(d2 + d5)
        sComb.Add(d3 + d4)
        sComb.Add(d3 + d5)
        sComb.Add(d4 + d5)
        sComb.Add(d1 + d2 + d3)
        sComb.Add(d1 + d2 + d4)
        sComb.Add(d1 + d2 + d5)
        sComb.Add(d1 + d3 + d4)
        sComb.Add(d1 + d3 + d5)
        sComb.Add(d1 + d4 + d5)
        sComb.Add(d2 + d3 + d4)
        sComb.Add(d2 + d3 + d5)
        sComb.Add(d2 + d4 + d5)
        sComb.Add(d3 + d4 + d5)
        sComb.Add(d1 + d2 + d3 + d4)
        sComb.Add(d1 + d2 + d3 + d5)
        sComb.Add(d1 + d2 + d4 + d5)
        sComb.Add(d1 + d3 + d4 + d5)
        sComb.Add(d2 + d3 + d4 + d5)
        sComb.Add(d1 + d2 + d3 + d4 + d5)
 
Back
Top Bottom