Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

[RESOLVED] Radio ComboBox Group (Changing value on one combo affects others)

$
0
0
Hey all,

I have a rather strange request, or well... I am requesting something that could possibly have an alternative solution.

I have 3 ComboBoxes all with the same data, and each ComboBox has 3 elements. Suppose, for example, the 3 elements are "APPLES", "ORANGES", "BANANAS".

So what I am seeking to do is to take the Click() event from the ComboBoxes (note that these are in a Control array) and use it so that when one ComboBox needs to change its value, all other ComboBox'es will not contain that same selected text.

If the first combobox's text = APPLES, the second = ORANGES, and the third = BANANAS;
When I manually change the third combobox's text to be APPLES, I want the first combobox's text to change to be whatever option was not selected (in this case it'd be BANANAS)
Does this make sense?

Anyways, I am having difficulty with this algorithm, which is mainly what I am seeking.
Current I know how to detect which combobox needs to change, I just don't know how to get the correct value to change it to:
Code:

Private Sub ComboBoxes_Click(Index As Integer)
    Dim idx As Integer
    For idx = 0 To 2
        If ComboBoxes(idx).ListIndex = ComboBoxes(Index).ListIndex Then 'If there is a combobox that is currently using the newly selected index...
            'ComboBoxes(idx).ListIndex = newIndex  '<-- What is the value of newIndex?
            Exit For
        End If
    Next
End

PS: It's a good idea to know that whenever you programmatically change the ListIndex of a combo, the Click() event is triggered.

I appreciate all the help you can give. :)

Thanks and God Bless!
-Nick


View Solution

Viewing all articles
Browse latest Browse all 21842

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>