Link to home
Start Free TrialLog in
Avatar of bswiftly
bswiftly

asked on

VS.NET Debugging: Variable watch

I know in VisualAge for Java I used to be able to put a breakpoint on a variable...not at a particular point in the code, but in a debugging window, and the code would break as soon as that variable was changed, or became a certain value.. (useful for loops if you want to break a loop when it hits 100 iterations etc, or a boolean field validating to true).

yes.. I know I could just put a breakpoint on this line:   If var = true then var = true    or something like that..but you won't get any points for an answer like that.

Does anyone know? Even a work-around would be somewhat satisfactory.. (Ie i tried declaring the bool value 'WithEvents' but it wouldn't let me).

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of mmarinov
mmarinov

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
Avatar of bswiftly
bswiftly

ASKER

Thanks,

I remember trying this method before and it says that VB, or C# don't support variable breakpoints.

Does anyone have a work around or know how to declare a variable with events?
actually i've tested it right know and it works fine with c# :)
the only special think is that when you set a break point in a function you can set it on the first function's line

B..M
well I am in a VB environment, and i entered in C# (just to see if i'd get the error too.. cuz i'm always looking for a reason to change to C#).

Alright.. you got it to work on a function..thats great.  and easy.  

try this:
declare  a boolean value.  
modify it in a few different places in your code...
set up a breakpoint not on a particular line of code, or at the entry point of a particular method, but when the boolean variable changes its vlaue.

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