Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:01:53+00:00 2026-06-07T17:01:53+00:00

In my test scenario, all of the combo boxes have the same value displayed

  • 0

In my test scenario, all of the combo boxes have the same value displayed (“<–Select–>”).

private bool AtLeastOnePlatypusSelected()
{
    string DefaultPlatypusValue = "<--Select-->";
    return (cmbxWeek1.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek2.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek3.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek4.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek5.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek6.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek7.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek8.SelectedValue != DefaultPlatypusValue) ||
           (cmbxWeek9.SelectedValue != DefaultPlatypusValue);
}

…yet this function is returning true.

Here’s the other combobox code:

public ObservableCollection<ComboBoxItem> cbItems { get; set; }
public ComboBoxItem SelectedcbItem { get; set; }
private Dictionary<int, int> PointNumToWeekNumPairings = new Dictionary<int, int>();

public MainWindow()
{
    InitializeComponent();
    DataContext = this;

    cbItems = new ObservableCollection<ComboBoxItem>();
    var cbItem = new ComboBoxItem { Content = "<--Select-->" };
    SelectedcbItem = cbItem;
    cbItems.Add(cbItem);
    cbItems.Add(new ComboBoxItem { Content = "Tony Iommi" });
    cbItems.Add(new ComboBoxItem { Content = "Mike McCarthy" });
    cbItems.Add(new ComboBoxItem { Content = "Micah Profit" });
    cbItems.Add(new ComboBoxItem { Content = "Allan Poe" });
    cbItems.Add(new ComboBoxItem { Content = "Bill Bailey" });
    cbItems.Add(new ComboBoxItem { Content = "Duane Eddy" });
    cbItems.Add(new ComboBoxItem { Content = "John Kennedy" });
    cbItems.Add(new ComboBoxItem { Content = "Bert Erneson" });
    cbItems.Add(new ComboBoxItem { Content = "Clyde Valouch" });
    cbItems.Add(new ComboBoxItem { Content = "Micky Thompson" });
}

What the Pork Link Wray Charles Dickens is going on here?!?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:01:54+00:00Added an answer on June 7, 2026 at 5:01 pm

    If your example is a Winforms example, SelectedValue is an object containing the value of the member of the data source specified by the ValueMember property. If you do not have a ValueMember Assigned use the SelectedItem Property instead.


    Be aware that the SelectedValue property and SelectedItem property in WPF return ComboBoxItem objects so you are comparing a ComboBoxItem to a String. Try changing your comparison to something like this:

    private bool AtLeastOnePlatypusSelected()
    {
    
        string DefaultPlatypusValue = "<--Select-->";
        return (string)((ComboBoxItem)cmbxWeek1.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek2.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek3.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek4.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek5.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek6.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek7.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek8.SelectedValue).Content != DefaultPlatypusValue ||
               (string)((ComboBoxItem)cmbxWeek9.SelectedValue).Content != DefaultPlatypusValue;
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to RSpec and I have a test scenario in which I
Following on from this question...I'm trying to unit test the following scenario: I have
I have a scenario where I navigate to a test site, but for whatever
I have the following scenario, class foo { ... private: char *_test; }; void
Hallo all, I am writing service in internet scenario. I have to implement message
I'm implementing a continuous integration scenario for a SharePoint deployment. After all features have
If I have rspec test like following: context main context do before(:all) do #
I have a scenario where the code under test inserts a record into a
i have the following scenario in my hbase instance hbase(main):002:0> create 'test', 'cf' 0
I tried to use AsyncProcessor in test scenario, expecting only one message to run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.