Selecting a default value in a ComboBox?

For the question above, I know how to do what I want as the final result...I just think it would take more code than necessary which is the reason for this question.

I have 2 ComboBox controls on my windows form (see attached image). They are bound to a DataTable and contain two identical items each.


What I need to happen:

When the user selects a value from either CB, the other CB needs to show ONLY the other value. Is there a quick way of doing this without using alot of code?
Who is Participating?
Mike EghtebasConnect With a Mentor Database and Application DeveloperCommented:
You are selecting from cmbDirection1 so that it will be removed from cmbDirection2:

cmbDirection2.Items.Remove(cmbDirection1.Text)  '<-- goes in cmbDirection1_TextChange event

This should do but try first doing in steps like:

Dim strTemp As String = cmbDirection1.Text    '<-- to make sure this is correct syntax for your settings. and then try:


you may have to use:  Dim strTemp As String = cmbDirection1.SelectedText
BlakeMcKennaAuthor Commented:
That worked great! Thank you...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.