VB6 SP6 BUG Using NOT keyword??!!!

From: B. Nichols (bnichols_at_herff-jones.com)
Date: 05/17/04


Date: Mon, 17 May 2004 13:51:07 -0700

Like some, I too have to maintain VB6 applications even though our company has gone .NET for new development. Having that said, I am having a very unusual problem with VB6 that didn't show up until I installed SP 6. I don't know if it's specific to my machine or not (since I am the only one with SP6 intalled), but thought I would post it here none the less. The problem lies in using the NOT keyword in an IF... END IF block.

I have a function (which returns a Boolean) call that checks for an existing Internet connection, and executes a block of code if the connection does not exist, as such:

IF Not CheckInternet Then
  <DO THIS>
Else
  <DO THAT>
End If

Whenever the CheckInternet function returns TRUE, the <DO THIS> condition executes anyway. I've even put the return into a boolean variable to see if it was somehow a function call problem:

Dim bResult As Boolean
bResult = CheckInternet
If Not bResult Then
  <DO THIS>
Else
  <DO THAT>
End If

Again... the <DO THIS> condition still executed when bResult was TRUE. The next thing I did was take out the NOT keyword and set the statement as so:

If CheckInternet = False Then
  <DO THIS>
Else
  <DO THAT>
End If

This time the condition executed correctly, doing the <DO THAT> block... Did SP6 somehow change the NOT keyword?? Let me know if anyone else is seeing this odd problem.

Brian Nichols
Herff Jones, Inc.



Relevant Pages

  • Re: NotInList Firing Problem
    ... out of dialog mode so the calling code can continue. ... triggers the ... If statement checks the boolean and if True it ... The line of code that executes next is the line that sets ...
    (microsoft.public.access.formscoding)
  • Re: NotInList Firing Problem
    ... If cboDefendantsName.Value NewData Then ... The nested IfThen set the boolean to True than False. ... triggers the ... The line of code that executes next is the line that sets ...
    (microsoft.public.access.formscoding)
  • Re: How to conditionally use a specified module
    ... u> danny wrote: ... that will still fail if the boolean value is set at runtime since use ... executes at compile time. ...
    (perl.beginners)
  • Re: What is faster?
    ... I'm not sure which is faster, but aren't you being redundant by checking if ... A boolean stands by itself as a condition. ... If bResult Then ... > 1) Inside a Loop: ...
    (microsoft.public.vb.general.discussion)
  • Re: How to conditionally use a specified module
    ... that will still fail if the boolean value is set at runtime since use ... executes at compile time. ...
    (perl.beginners)

Loading