Solved

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

Posted on 2014-04-22
3
215 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now