Re: decimal to binary
"Rory Daulton" <[email protected]> Thu, 14 Aug 2003 19:13:39 -0400
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <000b01c362b9$b2665ab0$6401a8c0@laptop> |
gws32750, > I > am looking for a fast way to convert a decimal number (0-256) into > binary and then set the value of eight differnt check boxes based on > the value of the binary number. What do you mean "convert to binary"? A number is almost never stored in decimal; any number stored in an Integer or similar type is stored in binary. Just about the only way that "convert decimal to binary" makes sense is if the number is in ASCII (text) format in decimal, and you want to convert it to text format in binary. As for the check boxes, the simplest way is: CheckBox0.Checked := MyNumber and (2 shl 0); CheckBox1.Checked := MyNumber and (2 shl 1); CheckBox7.Checked := MyNumber and (2 shl 7); Rory Daulton [email protected] --- [This E-mail scanned for viruses by Declude Virus and Nmax "Your MAXimum Connection!"] [This E-mail scanned for spam by Declude JunkMail and Nmax "Your MAXimum Connection!"] ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM ---------------------------------------------------------------------~-> CodeCoffer - new Delphi code protection Tool! http://www.delphicollection.com/public/CodeCoffer.htm --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/