Solved

VS.NET Debugging: Variable watch

Posted on 2004-04-21
5
438 Views
Last Modified: 2012-06-27
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!
0
Comment
Question by:bswiftly
  • 2
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 30 total points
Comment Utility
0
 
LVL 1

Author Comment

by:bswiftly
Comment Utility
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?
0
 
LVL 28

Expert Comment

by:mmarinov
Comment Utility
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
0
 
LVL 1

Author Comment

by:bswiftly
Comment Utility
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.

0
 
LVL 7

Assisted Solution

by:Z_Beeblebrox
Z_Beeblebrox earned 20 total points
Comment Utility
Hi,

The VB.Net debugger is very powerful. If you add a breakpoint, you can right click on the brown ball, and select breakpoint properties. From there, you can set the break point to only fire when a certain condition is true (e.g. a loop counter is a certain value) or when the break point has been hit a certain number of times (also useful for a loop!). That should suffice to meet  at least some of your requirements. Unfortunately, it doesn't do the variable watch thing that VB6 does which is very useful.

Zaphod.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

14 Experts available now in Live!

Get 1:1 Help Now