|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
True = -1 ?This has been bugging me for a while. Why is VB like the only language that
treats the boolean value of True as the integer -1? C/C++, C#, and Java, to name a few, all treat it as the integer 1. This gets to be annoying when you are trying to set the value of a checkbox to 1. When you set the value to True, you get an error because -1 (boolean True) is not a valid property value for the CheckBox.Value property. In this case, the easiest way around this is to wrap the boolean with Abs() to force it to output a 1 instead of a -1. Why did MS ever design VB this way? -- Chris Lieb UPS CACH, Hodgekins, IL Tech Support Group - Systems/Apps Chris Lieb wrote:
> This has been bugging me for a while. Why is VB like the only Simply put... Every other language is wrong. <g>> language that treats the boolean value of True as the integer -1? > C/C++, C#, and Java, to name a few, all treat it as the integer 1. > This gets to be annoying when you are trying to set the value of a > checkbox to 1. When you set the value to True, you get an error > because -1 (boolean True) is not a valid property value for the > CheckBox.Value property. In this case, the easiest way around this > is to wrap the boolean with Abs() to force it to output a 1 instead > of a -1. Why did MS ever design VB this way? Here's a more in-depth discussion/explanation: Microsoft Basic Logical Expression Evaluation http://vb.mvps.org/tips/truth.asp Later... Karl Karl,
> Simply put... Every other language is wrong. <g> I can't for the life of me understand why he continues to call VB's AND, OR,> > Here's a more in-depth discussion/explanation: > > Microsoft Basic Logical Expression Evaluation > http://vb.mvps.org/tips/truth.asp XOR, etc. operators *logical*. They are bitwise, and that is why True should be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it wouldn't matter if True was -1 or 1, or 45 for that matter. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message Could it be, perhaps, maybe, that this is how they are known generically? news:%231kRlfmVFHA.628@tk2msftngp13.phx.gbl... > Karl, > >> Simply put... Every other language is wrong. <g> >> >> Here's a more in-depth discussion/explanation: >> >> Microsoft Basic Logical Expression Evaluation >> http://vb.mvps.org/tips/truth.asp > > I can't for the life of me understand why he continues to call VB's AND, > OR, > XOR, etc. operators *logical*. Maybe it's possible that all the MS documentation for 30 years has refered to them as logical operators? Hmmm.... Tell ya what. How about you get into ClassicVB, put yer cursor on one of these critters (try "And" maybe), and see what the Help calls them. You'll get something like: ============== Used to perform a logical conjunction on two expressions. Syntax result = expression1 And expression2 The And operator syntax has these parts: Part Description result Required; any numeric variable. expression1 Required; any expression. expression2 Required; any expression. ================ Heck, you might even want to look back to DOS or CP/M versions to see what they say. It's pretty much like I explained in the paper. > They are bitwise, and that is why True should You need to read the paper again. That's *exactly* what I said.> be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it > wouldn't matter if True was -1 or 1, or 45 for that matter. Did you even *read* it???!?! They are *called* logical operators because, well, that's what they've been called in Basic documentation! If you want to use a definition from another language, maybe you should consider using that definition in the context that language. Later, Dan Dan,
> Tell ya what. How about you get into ClassicVB, put yer cursor on one of And this makes these operators other than bitwise?> these critters (try "And" maybe), and see what the Help calls them. You'll > get something like: > > They are bitwise, and that is why True should If you said that, then you agree that these operators are bitwise. So why> > be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it > > wouldn't matter if True was -1 or 1, or 45 for that matter. > > You need to read the paper again. That's *exactly* what I said. take exception to my comments? And why call them logical? > If you want to use a definition from another language, maybe you should I don't consider the term bitwise to be language-specific. Are you saying> consider using that definition in the context that language. otherwise? -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm
Show quote
"Jonathan Wood" <jw***@softcircuits.com> wrote in message I'm saying, in plain English, that Boolean operators in MS Basic product news:Ot40wEoVFHA.3532@TK2MSFTNGP09.phx.gbl... > Dan, > >> Tell ya what. How about you get into ClassicVB, put yer cursor on one of >> these critters (try "And" maybe), and see what the Help calls them. > You'll >> get something like: > > And this makes these operators other than bitwise? > >> > They are bitwise, and that is why True should >> > be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then > it >> > wouldn't matter if True was -1 or 1, or 45 for that matter. >> >> You need to read the paper again. That's *exactly* what I said. > > If you said that, then you agree that these operators are bitwise. So why > take exception to my comments? And why call them logical? > >> If you want to use a definition from another language, maybe you should >> consider using that definition in the context that language. > > I don't consider the term bitwise to be language-specific. Are you saying > otherwise? documentation (and most discussion) are called Logical Operators. Not only do the documentation sets call them logical, they are "logical" in the sense that they are not arithmetic. They are *also* bitwise, because that is how they are implemented. They are bitwise logical. For example 01 AND 01 is 01. If they were, for arithmetic bitwise the result would be 10. If you want to call them something else, that's fine. Dan "Jonathan Wood" <jw***@softcircuits.com> wrote I've always thought he's confused the issue, myself. But, I approve of calling> I can't for the life of me understand why he continues to call VB's AND, OR, > XOR, etc. operators *logical*. They are bitwise, and that is why True should > be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it > wouldn't matter if True was -1 or 1, or 45 for that matter. them logical operators because they correspond to the named 'logic' gates found in electronics. Individual gates typically act on individual bits.... What I didn't like was the (abstracted) distinction between logical operations, and boolean tests: <quote> First, understand that logical operations and tests are two different things. For tests only (that is, the expression tested by IF and whatnot), a zero value is judged to be false, any nonzero value is judged to be the truth (well, True). </quote> The sentence, "For tests only..." is clearly a misleading statement: Debug.Print CBool(1) Where is there any sort of 'test' in that??? Yet it results in a True or False result depending on the numerical value used.... A more concise explaination: VB's logical operations yield numerical results based on bitwise comparisons. If the result is not 0, then it is regarded as being True. VB's value of True is an Integer based on the result of the logical operation: X = Not False. That is all there needs to be said on that topic. LFS Larry,
> I've always thought he's confused the issue, myself. But, I approve of Okay, but as you state, they are acting on individual bits. That's what I'vecalling > them logical operators because they correspond to the named 'logic' gates found > in electronics. Individual gates typically act on individual bits.... always described as bitwise. To me, logical refers to a boolean state. What names would you use to distinguish between the two? > What I didn't like was the (abstracted) distinction between logical Heh, actually, I thought that part made sense because IF statements areoperations, and > boolean tests: logical whereas AND, OR, etc. are bitwise. :-) > The sentence, "For tests only..." is clearly a misleading statement: Well, my description of "a boolean state" might be a bit more general here> > Debug.Print CBool(1) > > Where is there any sort of 'test' in that??? Yet it results in a True or False result > depending on the numerical value used.... than "for tests only." > VB's logical operations yield numerical results based on bitwise comparisons. If the> result is not 0, then it is regarded as being True. VB's value of True is I pretty much agree with that description. However, I know that people whoan Integer > based on the result of the logical operation: X = Not False. > > That is all there needs to be said on that topic. understand this still can get caught off guard by the behavior of the AND, OR, etc. operators when applied to integer values. So my description might go a bit more into detail about using those operators. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm "Jonathan Wood" <jw***@softcircuits.com> wrote Consider: What is the logical outcome of this premis?> Okay, but as you state, they are acting on individual bits. That's what I've > always described as bitwise. To me, logical refers to a boolean state. What > names would you use to distinguish between the two? As you see the meaning of the term 'logical' is a bit too wide to try to tie it to specific operations. Why not just numerical, and boolean? > Heh, actually, I thought that part made sense because IF statements are While you might appear to be logical, you would rarely ever appear to be bitwise!> logical whereas AND, OR, etc. are bitwise. :-) Again, you can see 'logical' is a context based word, so finding another term to narrow down the idea being communicated, would be beneficial. > > That is all there needs to be said on that topic. Yeah, that can happen, but where does the fault lie there?> > I pretty much agree with that description. However, I know that people who > understand this still can get caught off guard by the behavior of the AND, > OR, etc. operators when applied to integer values. > So my description might go a bit more into detail about using those operators. That was a concise description, more hand-holding could be added, and thatis apparently what Dan was doing. But I would advise against adding more complexity, when trying to explain how simple it is! <g> LFS Larry,
> > Okay, but as you state, they are acting on individual bits. That's what Well, it was a question, actually.I've > > always described as bitwise. To me, logical refers to a boolean state. What > > names would you use to distinguish between the two? > > Consider: What is the logical outcome of this premis? > As you see the meaning of the term 'logical' is a bit too wide to try to I was using the term "logical" pretty much interchangeably with Boolean. Sotie it > to specific operations. Why not just numerical, and boolean? either term probably works for me. If I choose that term instead, then I'd call the two types of operations bitwise and Boolean. > That was a concise description, more hand-holding could be added, and that I agree. Or at least separate the bitwise stuff into a separate tutorial for> is apparently what Dan was doing. But I would advise against adding more > complexity, when trying to explain how simple it is! those people who do not know that stuff and want to learn. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm "Jonathan Wood" <jw***@softcircuits.com> wrote Yeah, that is what I meant...> I was using the term "logical" pretty much interchangeably with Boolean. So > either term probably works for me. If I choose that term instead, then I'd > call the two types of operations bitwise and Boolean. LFS "Larry Serflaten" <serfla***@usinternet.com> wrote in message The numerical value must be "tested" to see which logical value to assign. news:OndBdeoVFHA.1404@TK2MSFTNGP09.phx.gbl... > quote> > > The sentence, "For tests only..." is clearly a misleading statement: > > Debug.Print CBool(1) > > Where is there any sort of 'test' in that??? Yet it results in a True or > False result > depending on the numerical value used.... The value of logicals is determined by testing, not by calculation. But, call it what you want. I needed a word to use. I used the term "test" because it makes sense to most people and it is distinct from other evaluations. If you want to use the term "calculate" (or something else), that's fine. The key point is that in this "test/calculation/determination/conversion", Zero is False, everything else is True. Dan Johathan,
BTW, the major reason I wrote that paper was to document the *behavior* of logical expressions to highlight one of the major issues with VB.Net for the VB team. It was a summary of many answers given in newsgroups over the years, answering questions on their behavior. At the time I wrote that, VB.Net logical expression evaluation did NOT work that way. Valid logical expressions from VB6 could provide completely different results in VB.Net, and not show an error in either. The VB *dev team* did not really seem to understand how the expression evaluator had worked for years. VB.Net logical expression evaluation was changed after the MVP summit the following spring. Unfortunately, instead of recognizing the core language problem, they only fixed a couple of symptoms like this. Dan Show quote "Jonathan Wood" <jw***@softcircuits.com> wrote in message news:%231kRlfmVFHA.628@tk2msftngp13.phx.gbl... > Karl, > >> Simply put... Every other language is wrong. <g> >> >> Here's a more in-depth discussion/explanation: >> >> Microsoft Basic Logical Expression Evaluation >> http://vb.mvps.org/tips/truth.asp > > I can't for the life of me understand why he continues to call VB's AND, > OR, > XOR, etc. operators *logical*. They are bitwise, and that is why True > should > be -1 in VB. If VB supported logical AND, OR, XOR, etc. operators, then it > wouldn't matter if True was -1 or 1, or 45 for that matter. > > -- > Jonathan Wood > SoftCircuits > http://www.softcircuits.com > Available for consulting: http://www.softcircuits.com/jwood/resume.htm > > Dan,
> BTW, the major reason I wrote that paper was to document the *behavior* of Yes, I'm aware of the difference, and also that this was at least part of> logical expressions to highlight one of the major issues with VB.Net for the > VB team. It was a summary of many answers given in newsgroups over the > years, answering questions on their behavior. > > At the time I wrote that, VB.Net logical expression evaluation did NOT work > that way. Valid logical expressions from VB6 could provide completely > different results in VB.Net, and not show an error in either. the reason you felt the need for the article. I guess I view the issue from a slightly different angle, even though we both appear to understand how those operators work. > The VB *dev team* did not really seem to understand how the expression Heheh, well, that's hard to believe, but I understand the frustration of> evaluator had worked for years. dealing with them at times. > VB.Net logical expression evaluation was changed after the MVP summit the I was there. While I thought it was great that the language would be given> following spring. Unfortunately, instead of recognizing the core language > problem, they only fixed a couple of symptoms like this. both Boolean and bitwise operators, I thought the approach they ended up with left much to be desired. -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm Jonathan Wood wrote:
>> VB.Net logical expression evaluation was changed after the MVP I hereby nominate this for the "2005 Understatement of the Year" award.>> summit the following spring. Unfortunately, instead of recognizing >> the core language problem, they only fixed a couple of symptoms like >> this. > > I was there. While I thought it was great that the language would be > given both Boolean and bitwise operators, I thought the approach they > ended up with left much to be desired. Do I hear any seconds? <g>
Show quote
"Karl E. Peterson" <k***@mvps.org> wrote in message <chuckle> Yea. 2nd.news:%23zdeurxVFHA.2448@TK2MSFTNGP12.phx.gbl... > Jonathan Wood wrote: >>> VB.Net logical expression evaluation was changed after the MVP >>> summit the following spring. Unfortunately, instead of recognizing >>> the core language problem, they only fixed a couple of symptoms like >>> this. >> >> I was there. While I thought it was great that the language would be >> given both Boolean and bitwise operators, I thought the approach they >> ended up with left much to be desired. > > I hereby nominate this for the "2005 Understatement of the Year" award. > > Do I hear any seconds? <g> He's got it right though, unlike some others who still don't "get it". I'll try to compete for that award: It's unfortunate that MS never acknoledged or addressed the core problem of language stability. Dan <sigh... after 4 years they still don't "get it"> Dan Barclay wrote:
Show quote > "Karl E. Peterson" <k***@mvps.org> wrote in message Unfortunate, yes... <sigh> Yeah, that'd have to be tossed into the running, there.> news:%23zdeurxVFHA.2448@TK2MSFTNGP12.phx.gbl... >> Jonathan Wood wrote: >>>> VB.Net logical expression evaluation was changed after the MVP >>>> summit the following spring. Unfortunately, instead of recognizing >>>> the core language problem, they only fixed a couple of symptoms >>>> like this. >>> >>> I was there. While I thought it was great that the language would be >>> given both Boolean and bitwise operators, I thought the approach >>> they ended up with left much to be desired. >> >> I hereby nominate this for the "2005 Understatement of the Year" >> award. >> >> Do I hear any seconds? <g> > > <chuckle> Yea. 2nd. > > He's got it right though, unlike some others who still don't "get it". > > I'll try to compete for that award: > > It's unfortunate that MS never acknoledged or addressed the core > problem of language stability. Seems *some* at MSFT are starting to get it... http://blogs.msdn.com/ericgu/archive/2005/05/09/415751.aspx Probably too late for the company to survive, though. <shrug> "Jonathan Wood" <jw***@softcircuits.com> wrote in message Yes, it was hard to believe. The guys I talked to (outside the meeting >> The VB *dev team* did not really seem to understand how the expression >> evaluator had worked for years. > > Heheh, well, that's hard to believe, but I understand the frustration of > dealing with them at times. room) simply didn't understand it. Rob wanted to talk to me about it and I, err... "explained" what I was talking about. It was as if he hadn't considered the differences or what they meant. I had one of the doc guys hit me up for a copy of this paper at the meeting! Dan "Chris Lieb" <ChrisL***@discussions.microsoft.com> wrote in message Because VB does not have logical operators, only binary operators. Thenews:F3A39DDB-C628-4951-A6E1-222185C2BCD7@microsoft.com > This has been bugging me for a while. Why is VB like the only > language that treats the boolean value of True as the integer -1? > C/C++, C#, and Java, to name a few, all treat it as the integer 1. > This gets to be annoying when you are trying to set the value of a > checkbox to 1. When you set the value to True, you get an error > because -1 (boolean True) is not a valid property value for the > CheckBox.Value property. In this case, the easiest way around this > is to wrap the boolean with Abs() to force it to output a 1 instead > of a -1. Why did MS ever design VB this way? keywords Not, Or and And wok on the individual bits in each operand. The numeric value -1 has all bits on, or "true", which is the binary equivalent of "Not False". As long as you treat boolean values strictly as boolean and don't try to convert to numeric you won't have a problem. In a language with both logical and binary operators, like C, there are reasons for making True=1 but neither 1 or -1 is really better than the other as long as you are consistent within the language. BTW, the easiest way to set a checkbox value correctly is checkbox1.Value = IIF(testvalue, vbChecked, vbUnchecked) That will let you use +1 or -1 or any other non-zero value while also using the constants for readability and eliminating the hack of converting boolean to numeric. -- Reply to the group so all can participate VB.Net: "Fool me once..." I never realized that the operators in VB were all bitwise. I had always
figured that they were logical operators since you can't do things like bit shifts (<< and >>). At least now I know why True = -1. Thanks everyone. Show quote "Bob Butler" wrote: > "Chris Lieb" <ChrisL***@discussions.microsoft.com> wrote in message > news:F3A39DDB-C628-4951-A6E1-222185C2BCD7@microsoft.com > > This has been bugging me for a while. Why is VB like the only > > language that treats the boolean value of True as the integer -1? > > C/C++, C#, and Java, to name a few, all treat it as the integer 1. > > This gets to be annoying when you are trying to set the value of a > > checkbox to 1. When you set the value to True, you get an error > > because -1 (boolean True) is not a valid property value for the > > CheckBox.Value property. In this case, the easiest way around this > > is to wrap the boolean with Abs() to force it to output a 1 instead > > of a -1. Why did MS ever design VB this way? > > Because VB does not have logical operators, only binary operators. The > keywords Not, Or and And wok on the individual bits in each operand. The > numeric value -1 has all bits on, or "true", which is the binary equivalent > of "Not False". As long as you treat boolean values strictly as boolean and > don't try to convert to numeric you won't have a problem. > > In a language with both logical and binary operators, like C, there are > reasons for making True=1 but neither 1 or -1 is really better than the > other as long as you are consistent within the language. > > BTW, the easiest way to set a checkbox value correctly is > checkbox1.Value = IIF(testvalue, vbChecked, vbUnchecked) > > That will let you use +1 or -1 or any other non-zero value while also using > the constants for readability and eliminating the hack of converting boolean > to numeric. > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > > > This has been bugging me for a while. Why is VB like the only language that True = 0xFFFF which when coerced into an Integer == -1:> treats the boolean value of True as the integer -1? C/C++, C#, and Java, to > name a few, all treat it as the integer 1. This gets to be annoying when you > are trying to set the value of a checkbox to 1. When you set the value to > True, you get an error because -1 (boolean True) is not a valid property > value for the CheckBox.Value property. In this case, the easiest way around > this is to wrap the boolean with Abs() to force it to output a 1 instead of a > -1. Why did MS ever design VB this way? '*** Debug.Print Hex(True) ' Prints: FFFF Debug.Print &HFFFF ' Prints: -1 '*** If you're checking the value of a checkbox then either compare against the constant vbChecked, or just let type conversion do it for you: '*** If (Check1.Checked = vbChecked) Then ... If (Check1.Checked) Then ... '*** Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ On Wed, 11 May 2005 09:22:04 -0700, "Chris Lieb"
<ChrisL***@discussions.microsoft.com> wrote: >This has been bugging me for a while. Why is VB like the only language that VB treats anything that is non-zero as true so, it is the other>treats the boolean value of True as the integer -1? C/C++, C#, and Java, to >name a few, all treat it as the integer 1. This gets to be annoying when you >are trying to set the value of a checkbox to 1. When you set the value to >True, you get an error because -1 (boolean True) is not a valid property >value for the CheckBox.Value property. In this case, the easiest way around >this is to wrap the boolean with Abs() to force it to output a 1 instead of a >-1. Why did MS ever design VB this way? languages that are messed up. Your problem is that you are attempting to use true/false logic assignments with a checkbox. You should be using the constants vbChecked and vbUnChecked when working with checkboxes. HTH, Bryan ____________________________________________________________ New Vision Software "When the going gets weird," Bryan Stafford "the weird turn pro." alpine_don'tsendspam@mvps.org Hunter S. Thompson - Microsoft MVP-Visual Basic Fear and Loathing in LasVegas > Your problem is that you are attempting to use true/false logic Correct! And the reason is that the Value property of the CheckBox takes> assignments with a checkbox. You should be using the constants > vbChecked and vbUnChecked when working with checkboxes. one of three possible values... vbChecked, vbUnChecked and vbGrayed, not the two that a Boolean would indicate. Rick - MVP On Wed, 11 May 2005 14:14:39 -0400, "Rick Rothstein"
<rickNOSPAMnews@NOSPAMcomcast.net> wrote: >> Your problem is that you are attempting to use true/false logic Spot on >> assignments with a checkbox. You should be using the constants >> vbChecked and vbUnChecked when working with checkboxes. >Correct! And the reason is that the Value property of the CheckBox takes >one of three possible values... vbChecked, vbUnChecked and vbGrayed, not >the two that a Boolean would indicate. >Rick - MVP - I was wondering when someone would point that out False = NOT True
True = 0 therefore False = NOT 0 = FFFF FFFF FFFF ... in twos complement all Fs = -1 See http://burks.brighton.ac.uk/burks/foldoc/42/120.htm for an explaination of twos complement. Dave. Show quote "Chris Lieb" <ChrisL***@discussions.microsoft.com> wrote in message news:F3A39DDB-C628-4951-A6E1-222185C2BCD7@microsoft.com... > This has been bugging me for a while. Why is VB like the only language > that > treats the boolean value of True as the integer -1? C/C++, C#, and Java, > to > name a few, all treat it as the integer 1. This gets to be annoying when > you > are trying to set the value of a checkbox to 1. When you set the value to > True, you get an error because -1 (boolean True) is not a valid property > value for the CheckBox.Value property. In this case, the easiest way > around > this is to wrap the boolean with Abs() to force it to output a 1 instead > of a > -1. Why did MS ever design VB this way? > > -- > Chris Lieb > UPS CACH, Hodgekins, IL > Tech Support Group - Systems/Apps > False = NOT True Right idea, but you mixed up your True's and False's...> True = 0 therefore > False = NOT 0 = FFFF FFFF FFFF ... > in twos complement all Fs = -1 False = 0 True = Not False so.... True = Not 0 = FFFF FFFF ..... In Twos Complement, all Fs = -1 Rick - MVP Congratulations, you win the star prize for spotting the deliberate mistake.
The prize is a copy of VB.NET which I'm sure you'll enjoy. Show quote "Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message news:eGP2x6uVFHA.3764@TK2MSFTNGP15.phx.gbl... >> False = NOT True >> True = 0 therefore >> False = NOT 0 = FFFF FFFF FFFF ... >> in twos complement all Fs = -1 > > Right idea, but you mixed up your True's and False's... > > False = 0 > True = Not False > > so.... > > True = Not 0 = FFFF FFFF ..... > > In Twos Complement, all Fs = -1 > > Rick - MVP It's not the only language! I know of several languages that use True=-1,
and all for the same reason (outlined below by other posts). As for checkboxes, their value should be one of vbChecked, vbUnchecked, or vbGrayed, not True (irrespective of the internal value of True). Tony Proctor Show quote "Chris Lieb" <ChrisL***@discussions.microsoft.com> wrote in message news:F3A39DDB-C628-4951-A6E1-222185C2BCD7@microsoft.com... > This has been bugging me for a while. Why is VB like the only language that > treats the boolean value of True as the integer -1? C/C++, C#, and Java, to > name a few, all treat it as the integer 1. This gets to be annoying when you > are trying to set the value of a checkbox to 1. When you set the value to > True, you get an error because -1 (boolean True) is not a valid property > value for the CheckBox.Value property. In this case, the easiest way around > this is to wrap the boolean with Abs() to force it to output a 1 instead of a > -1. Why did MS ever design VB this way? > > -- > Chris Lieb > UPS CACH, Hodgekins, IL > Tech Support Group - Systems/Apps |
|||||||||||||||||||||||