Solved

Selecting a default value in a ComboBox?

Posted on 2014-12-05
2
118 Views
Last Modified: 2014-12-05
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.

"Tension"
"Compression"

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?
Screenshot.jpg
0
Comment
Question by:BlakeMcKenna
2 Comments
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 500 total points
ID: 40484033
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:

cmbDirection2.Items.Remove(strTemp)

you may have to use:  Dim strTemp As String = cmbDirection1.SelectedText
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40484052
That worked great! Thank you...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now