Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Selecting a default value in a ComboBox?

Posted on 2014-12-05
2
Medium Priority
?
125 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline

610 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