Solved

Can't get a break to work when a value changes?

Posted on 2014-04-22
3
217 Views
Last Modified: 2014-04-22
I'm trying to get my program to break when a certain variable changes it's value. I've always thought that the "Watch" will do this, however, I can't seem to get it to work. I tried setting up a watch and I KNOW that it hits this certain variable and when it changes value, the program doesn't break into the code-behind. Any ideas?

Thanks!
0
Comment
Question by:BlakeMcKenna
3 Comments
 
LVL 9

Assisted Solution

by:dustock
dustock earned 250 total points
ID: 40015107
A watch wont stop the program, you need to add breakpoints in by left clicking the on the far left of the code view.  Then when the program hits the break point it will stop and allow you to debug, and see the value of your watch as long is its active in the block of code you broke on.
0
 
LVL 20

Accepted Solution

by:
ElrondCT earned 250 total points
ID: 40015131
Unfortunately, VB won't do a break simply based on a variable changing at any point in the program. (Some other languages will do that.) You have to set a breakpoint at a specific location in the code, where you set a Condition (right-click on the breakpoint button to select) to see if the variable has changed from what it was the last time the debugger checked it. But it can sometimes be challenging to figure out exactly where a variable is getting changed if there are lots of possible procedures that could be called.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 40015260
I know how to set breakpoints. I thought the code did that whenever a variable changed it's value if you setup a watch. I thought VB6 did this but I must have been setting breaks and didn't realize it.

Thanks!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question