PMac
Member
- Joined
- Feb 17, 2012
- Messages
- 11
- Programming Experience
- Beginner
In the project I'm working on, the user selects different options from a group of combo boxes, and these selections determine what the program does next. The way I have my project checking what options the user has picked works fine, but is very messy, and requires A LOT of lines of code, since there are 504 different combinations possible from the different comboboxes.
As of now, the following is what I have written for all 504 different combinations of selections, but I know there must be a more efficient way of doing this...
If Me.Combobox1.SelectedItem = "Variable1" And Me.Combobox2.SelectedItem = "Variable2" And Me.Combobox3.SelectedItem = "Variable3" And Me.Combobox4.SelectedItem = "Variable4" And Me.Combobox5.SelectedItem = "Variable5" Then
' INSERT RESULT HERE
End If
If someone out there could point me in the right direction where I don't need 1000+ lines of code (which I already have) to accomplish this, it would be amazing!
Thanks,
Patrick
As of now, the following is what I have written for all 504 different combinations of selections, but I know there must be a more efficient way of doing this...
If Me.Combobox1.SelectedItem = "Variable1" And Me.Combobox2.SelectedItem = "Variable2" And Me.Combobox3.SelectedItem = "Variable3" And Me.Combobox4.SelectedItem = "Variable4" And Me.Combobox5.SelectedItem = "Variable5" Then
' INSERT RESULT HERE
End If
If someone out there could point me in the right direction where I don't need 1000+ lines of code (which I already have) to accomplish this, it would be amazing!
Thanks,
Patrick