Solved

Selecting a default value in a ComboBox?

Posted on 2014-12-05
2
114 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
Comment Utility
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
Comment Utility
That worked great! Thank you...
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

10 Experts available now in Live!

Get 1:1 Help Now