I am using the following code to add new data to the combobox and prevent duplicates.
When I run the program and attempt to add data to the combobox I get the following errorCode:If ReceiveComboBox.Items.Count = 0 And ReceiveComboBox.Text <> "" Then ReceiveComboBox.Items.Add(ReceiveComboBox.Text) ElseIf ReceiveComboBox.Text <> "" Then For Each item As String In ReceiveComboBox.Items.ToString If item <> (ReceiveComboBox.Text) Then ReceiveComboBox.Items.Add(ReceiveComboBox.Text) Exit For End If Next End If
I have three comboboxs and using the same code for all three, The user will need to add data to the comboboxes to all three comboboxes.Code:System.ArgumentException: 'Items collection cannot be modified when the DataSource property is set.'
What can I do to resolve this?




Reply With Quote
