Solved

Selecting a default value in a ComboBox?

Posted on 2014-12-05
2
119 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

772 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