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 6954177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:34:20+00:00 2026-05-27T14:34:20+00:00

i am using several checkboxcomboboxes . for my sollution one of these boxes needs

  • 0

i am using several checkboxcomboboxes. for my sollution one of these boxes needs to behave as a combobox in a specific situation. i need to select one value only. i tried the following:

    private void PreDefSerials_SelectedValueChanged(object sender, EventArgs e)
    {
        if (!one_select)
            return;
        else
        {
            // set selected value
            if (PreDefSerials.SelectedIndex != 0)
            PreDefSerials.CheckBoxItems[PreDefSerials.SelectedIndex].CheckState = CheckState.Checked;
            return;
        }
    }

EDTI:

how can i set all the checkstateds of the items to not-selected and aftwerwards make the checkstate of the latest selected value to selected?

  • 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-05-27T14:34:20+00:00Added an answer on May 27, 2026 at 2:34 pm

    I’m not familiar with that control, so I might not have all of the syntax correct, but I think you can try looping through your items and “unchecking” anything that was checked. Also, you would have to turn “off” the event for the time being or else this event would probably keep firing on every “uncheck”:

    private void PreDefSerials_SelectedValueChanged(object sender, EventArgs e)
    {
      if (!one_select)
        return;
      else
      {
        if (PreDefSerials.SelectedIndex > -1)
        {
          //only uncheck items if the current item was checked:
          if (PreDefSerials.CheckBoxItems[PreDefSerials.SelectedIndex].CheckState == CheckState.Checked)
          {
            // stop firing event for now:
            PreDefSerials.SelectedValueChanged -= PreDefSerials_SelectedValueChanged;
    
            for (int i = 0; i < PreDefSerials.CheckBoxItems.Count; i++)
            {
              if (i != PreDefSerials.SelectedIndex)
              {
                PreDefSerials.CheckBoxItems[i].CheckState = CheckState.Unchecked;
              }
            }
    
            // wire event again:
            PreDefSerials.SelectedValueChanged += PreDefSerials_SelectedValueChanged;
          }
        }
      }
    }
    

    This assumes that when you check an item, it will get checked and fire this event. This code just goes through the list and then “unchecks” everything else. Refactor as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple situation. A large organisation is using several different versions of
I have an .htaccess file that's using several rewrite rules. These rules aren't working
In a webapp I'm using several filters and in one of the filter I'm
I have the following information that should be retrieved by using several dependent select
I need to access data from a webpage using several different post requests. For
I need an application to produce a PDF file using several different custom templates.
I'm currently stuck using several JavaScript libraries that MUST load in a very specific
I am using several accounts to manage my customers iPhone/iPad applications. Therefore I need
I'm using several variants of the Validator controls (RequiredFieldValidator, CompareValidator, etc) and am using
I am using several NSButtonCell objects in an NSTableView. They are simple square buttons

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.