Hi, so im having the user pick two separate colors. Now when they pick the 2.... im going to run an event that determines that combination..... for an example if the user picks red and blue the outcome will be +5 points. Now the only way i can think of how to have it go through all of the possible combinations is using IF statements..... like

'comboboxes are where users will select colors
if combobox.items(0) and Combobox2.items(1) then
score += 5
end if

is there a more efficient way? because im going to have about 60 different combinations.... and IF there is a better way DONT write all the code for me just point me in the right direction. thanks

See if this helps.

'//------ Pre-requisites: 1 Button, 2 ComboBoxes. ----------\\
Public Class Form1
    
    Private myScoreArray() As Integer = {"2", "4", "6", "8", "10"} '// set scores here.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '// display result by using .SelectedIndex to select an array from "myScoreArray".
        MsgBox(myScoreArray(ComboBox1.SelectedIndex) + myScoreArray(ComboBox2.SelectedIndex))
    End Sub
End Class

...and IF there is a better way DONT write all the code for me...

Sometimes easier to write code "for me". :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.