Hi,
Hope you can help. I'm using a combobox for my user to chose an option from which then loads text / items into another combobox.
The problem I'm having is that if I keep flicking between comboboxes it keeps adding the items over and over again. I know that's doing it because the code is telling it to do it but is there anyway to add any validation to say if items have already been added don't add them again?
I don't really want to change the code as its the way I want to program to work.
Code i'm using to get a basic idea:
Thanks
Ian
Hope you can help. I'm using a combobox for my user to chose an option from which then loads text / items into another combobox.
The problem I'm having is that if I keep flicking between comboboxes it keeps adding the items over and over again. I know that's doing it because the code is telling it to do it but is there anyway to add any validation to say if items have already been added don't add them again?
I don't really want to change the code as its the way I want to program to work.
Code i'm using to get a basic idea:
Code:
Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
If ComboBox1.Text = "Colour" Then
ComboBox2.Items.Add("Blue")
ComboBox2.Items.Add("Yellow")
ComboBox2.Items.Add("Green")
End If
End SubIan