Scott:
 
The are two keys to debugging: Watch what the machine does when the program is run interactively.  You will have limited control, of course, and won't be able to single-step through your code, but you will be able to see exactly the same things that BWS sees on the screen.
 
T'other key is using way too many displays of information that is "obvious".  For example, instead of using
IF AT ("some prompt")
    <statement>
ELSE
    <statement>
END IF
for debugging use something like
IF AT ("some prompt")
    <statement>
    iTemp = MsgBox("Condition 1 true.", vbExclamation, "An expected result")
ELSE
    IF AT ("some other prompt")
        <statement>
        iTemp = MsgBox("Condition 2 true.", vbExclamation, "An expected result")
    ELSE
        IF AT ("a third prompt")
            <statement>
            iTemp = MsgBox("Condition 3 true.", vbExclamation, "An expected result")
        ELSE
            <statement>
            iTemp = MsgBox("I'm totally lost!.", vbExclamation, "Help!")
        END IF
    END IF
END IF
That way you'll be certain where you are in your logic. 
 
Bruce has asked about cleaning out variables between events.  Be sure that you initialize all variables, whether you think they need to be or not.  Some languages try to be nice to you by not requiring that you force strings to be empty, et cetera.  Don't trust a program that tries to be smarter than you are.
 
Pax,
Ernest 21 Oct 04
-----Original Message-----
From: Adams,Ernest [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 21, 2004 4:14 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] Variable not updating

Scott:
 
Put the code on lines like this
' Comment about what is being tested.
IF <condition>
    ' comment about why
    <statement(s)>
ELSE
    ' comment about why
    <statement(s)>
END IF
and I'll bet dollars to donuts it works.  The comments are optional, of course, but good practice.
 
Pax,
Ernest 21 Oct 04
-----Original Message-----
From: White, Scott A [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 21, 2004 4:08 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Variable not updating

Yes; but each time I tried to take the : out after the Else, VB would put it back in again.
 
I'm stumped!!!!

<<attachment: image001.jpg>>

Reply via email to