473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Going into an infinite loop

Hi,

I'm a DBA learning C#, so am quite green.

I have a form http://www.markallison.co.uk/Images/squealfind2.jpg, on
the right there is a group of checkboxes with All Object Types as the
header.

Now, when I check All Object Types, all the other checkboxes take on the
chkAllObjectTypes check value. Great. What I want to happen is when one
of the other check boxes are checked, I want the chkAllObjectTypes
checkbox to change state to

1) Indeterminate (tristate) if all other checkboxes are not the same
2) Change to checked, if all other checkboxes are checked
3) Change to unchecked, if all other checkboxes are unchecked.

I've pretty much got 2 and 3 covered, I'm having a little trouble with
1. Code snapshot:
http://paste.mine.nu/Pastebin/Upload...1144674226.htm

Thanks.

--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
Nov 16 '05 #1
1 1294
You have loads of checks here. What you might want to do is think about
updating an integer or other value based on some bit ordinal... Something
like the following:

int allBits = 0;
allBits = (allBits << 1) + ((chkColumn.Checked) ? 1 : 0);
allBits = (allBits << 1) + ((chkColumn2.Checked) ? 1 : 0);

When you are done, you need to know how many bits you used. The
reason is you are going to & the value.. Above we added 2 bits, so we'll
use the value of 0x3 (11 in binary).

switch(allBits & 0x3) {
case 0x0:
chkAll.Checked = false;
break;
case 0x3:
chkAll.Checked = true;
break;
default:
chkAll.ThreeState = true; chkAll.CheckState = CheckState.Indeterminate;
break;
}

I'm not testing the above code, so there may be some fixes you need to make, but
the concept is solid enough for you to change your program appropriately...
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Mark Allison" <ma***@no.tinned.meat.mvps.org> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm a DBA learning C#, so am quite green.

I have a form http://www.markallison.co.uk/Images/squealfind2.jpg, on the
right there is a group of checkboxes with All Object Types as the header.

Now, when I check All Object Types, all the other checkboxes take on the
chkAllObjectTypes check value. Great. What I want to happen is when one of the
other check boxes are checked, I want the chkAllObjectTypes checkbox to change
state to

1) Indeterminate (tristate) if all other checkboxes are not the same
2) Change to checked, if all other checkboxes are checked
3) Change to unchecked, if all other checkboxes are unchecked.

I've pretty much got 2 and 3 covered, I'm having a little trouble with 1. Code
snapshot:
http://paste.mine.nu/Pastebin/Upload...1144674226.htm

Thanks.

--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
5
by: mailpitches | last post by:
Hello, Is there any way to kill a Javascript infinite loop in Safari without force-quitting the browser? MP
59
by: rami | last post by:
please everybody ,can anyone tell me how to do an infinite loop in C
44
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
48
by: James Watt | last post by:
can anyone tell me how to do an infinite loop in C/C++, please ? this is not a homework question .
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.