Problem in checkboxes set

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2008
Posts: 63
Reputation: aminit is an unknown quantity at this point 
Solved Threads: 0
aminit's Avatar
aminit aminit is offline Offline
Junior Poster in Training

Problem in checkboxes set

 
0
  #1
Apr 1st, 2008
Hello :

I 'd created a simple form , it consist of 2 set of checkboxs
1-6 checkboxes
2-6 checkboxes
I want to make a simple function determine if the first checkbox in set1 is checked it must test the checkboxes in set2 if the first is checked too or not .Any idea please???

Thanks inadvance...
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,297
Reputation: majestic0110 has a spectacular aura about majestic0110 has a spectacular aura about majestic0110 has a spectacular aura about 
Solved Threads: 68
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Nearly a Posting Virtuoso

Re: Problem in checkboxes set

 
0
  #2
Apr 1st, 2008
are you using a checked list box? if so this might help you a lot:

Computers are man's attempt at designing a cat: It does whatever it wants, whenever it wants, and rarely ever at the right time.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 7
Reputation: Reinard is an unknown quantity at this point 
Solved Threads: 1
Reinard Reinard is offline Offline
Newbie Poster

Re: Problem in checkboxes set

 
0
  #3
Apr 2nd, 2008
Does this help?

private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (checkedListBox1.GetItemCheckState(0) == CheckState.Checked)
{
checkedListBox2.SetItemChecked(0, true);

}
else
{
checkedListBox2.SetItemChecked(0, false);
}



}
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 63
Reputation: aminit is an unknown quantity at this point 
Solved Threads: 0
aminit's Avatar
aminit aminit is offline Offline
Junior Poster in Training

Re: Problem in checkboxes set

 
0
  #4
Apr 2nd, 2008
Hello :
Thanks for all answers but my ponit was :

group1 : checkbox1 checkbox2 checkbox3
group2 : checkbox4 checkbox5 checkbox6

all inside the form , I want to make a test function , make a test with the checked item and the item is against it , if checkbox2 is checked and checkox5 is checked too a messagebox appear , display a text ....etc
if not an error meassagebox appear ..etc not just checkbox 2&5 may be inside the form there are 50 checkbox's I can't in each item make a comperision .....can any one help???

Thanks in advance...
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 436
Reputation: JerryShaw is on a distinguished road 
Solved Threads: 72
JerryShaw JerryShaw is offline Offline
Posting Pro in Training

Re: Problem in checkboxes set

 
0
  #5
Apr 7th, 2008
Hello Aminit,

Just a thought... have you considered using a binary value to represent each group ?
Set the Tag value for each checkbox with a hex value. Have a method OR the hex values for each checkbox (method will iterate through all checkboxes in a group) resulting in a single value for each group.

Hint: if you have each checkbox group contained in a panel or groupbox it makes it easier to iterate all checkboxes in that container rather than filter on all checkboxes on the form.


Once you have a single binary value for each checkbox group. You can (AND) the value with the other group(s) to see which combinations are checked as a single value.

If you have some known conditions (like that one which creates an error message), then you can AND that condition (as a binary value) to the checkbox group binary values.

Its just a matter of math.

If this sounds confusing, consider it this way. If you can represent Group A as a single value, then you can use simple boolean operators to compare against specific conditions you want to check.


// Jerry
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 63
Reputation: aminit is an unknown quantity at this point 
Solved Threads: 0
aminit's Avatar
aminit aminit is offline Offline
Junior Poster in Training

Re: Problem in checkboxes set

 
0
  #6
Apr 12th, 2008
Hello :
Thanks a lot
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum


Views: 2872 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC