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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:14:24+00:00 2026-06-04T00:14:24+00:00

i found it is possible to validate checkboxes is selected or not by linq.

  • 0

i found it is possible to validate checkboxes is selected or not by linq.

i got the code like

btnAgree.Enabled = (from chkbox in Controls.OfType<CheckBox>() select chkbox).Count(b => b.Checked) >= 2;

but my scenario is like i have many check boxes on my win form but i want to check any check boxes inside my group box is selected by LINQ. is it possible but i found no way still. please help me with code.

i got a little code which is bit similar. the code as follows

public static IEnumerable<T> AllControls<T>(this Control startingPoint) where T : Control
{
 bool hit = startingPoint is T;
 if (hit)
 {
    yield return startingPoint as T;
 }
 foreach (var child in startingPoint.Controls.Cast<Control>())
 {
    foreach (var item in AllControls<T>(child))
    {
       yield return item;
    }
 }

}

 var checkboxes = control.AllControls<CheckBox>();
 var checkedBoxes = control.AllControls<CheckBox>().Where(c => c.Checked);

but how to customize this code that it will work with group box where my all check box is located. please guide. another issue is i am using c# v2.0. thanks

  • 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-04T00:14:26+00:00Added an answer on June 4, 2026 at 12:14 am
    btnAgree.Enabled = 
        (from chkbox in groupBox1.Controls.OfType<CheckBox>()
         select chkbox).Count(b => b.Checked) >= 2;
    

    You’re checking the controls of the form.

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

Sidebar

Related Questions

I have found possible slowdown in my app so I would have two questions:
Possible Duplicate: Empty for loop - for(;;) I just found a strange construct in
I've found a lot of solutions to about how its possible to copy a
I found a topic on MSDN that talks that yes, this is possible. I
In the Python docs I found that logging messages are possible in python scripts
Possible Duplicate: What does *args and **kwargs mean? Understanding kwargs in Python I've found
Wondering if it is at all possible. found: <script type=javascript> isSafari3 = false; if(window.devicePixelRatio)
Possible Duplicate: What does map(&:name) mean in Ruby? What does the &:valid? found in
I have a problem with XML validation with expat. I have not found document
I am using jquery validate and the jquery version of tinymce. I found this

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.