Link to home
Start Free TrialLog in
Avatar of wjshore
wjshore

asked on

VB6 and the equals sign

This really has me puzzled.  I'm debugging in a VB6 app.  In the following line:

                    M7Tag = Seed1Children("MovieID")

 the value for M7Tag is 115 while the value of Seed1Children("MovieID") is 391 !!!
How can that be?  I thought one of the immutible laws of computing was 'What's on the left of an equal sign must be the same as what's on the right.'

M7Tag is a global variable.  Seed1Chidren("MovieID") is a field in a Rescordset.  I get no error message.  I put a breakpoint 10 lines or so below this line - and got this result.  Does anyone know how VB6 could parse this line and not complain (Type Mismatch, Variable not defined, etc.)?  I don't know how to debug if I can't see what's happened here.  If you can't believe in an = sign, what's left in Life?    Signed,

Waiting for the sky to fall in Chicago

SOLUTION
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Normally it should work, but VB has a few stealthy issues that you need to watch for.

Go to Debug menu, Add Watch and add M7Tag.  Check the "Break when Value Changes" option.  Use "All Procedures"  "All Modules", as this is a global.  Now when the value of M7Tag is changed, your program will break at the code line where it happened (and you will know it doesn't happen somewhere else.)

How is M7Tag declared?  Double check that you have not declared it locally as well as globally.  (If you do this, VB will not complain, but will use the local declaration when it is in scope.)

Is Option Explicit at the top of your form/module/class?  If not, put it in and re-run.


Avatar of wjshore
wjshore

ASKER

I'm following advice and most of the puzzle remains.  I added a second, earlier, breakpoint and M7Tag watch.  Sure enough, when I stepped thru with F8, the value changed and M7Tag matched Seed1Children("MovieID").  This still leaves me the question; Why did it require stepping thru?  When I set the later breakpoint, didn't VB execute all the code up to that?  I thought that was the purpose of breakpoints?  p.s. Option Explicit is there.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial