Solved

break when a value changes

Posted on 2015-02-09
5
93 Views
Last Modified: 2015-02-09
vb.net
vs2012

I want to tell the debugger to stop when a value of "sometextbox.text"  changes
how do I do it?
0
Comment
Question by:MBHEY131
  • 2
  • 2
5 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 40598888
it is not as easy as it was in VB6 for example.

Create a property (get and set), in the TextChanged event of your textbox, set the new property. Finally, place a breakpoint in the setter property.
0
 

Author Comment

by:MBHEY131
ID: 40598917
I have no Idea how to even start to accomplish that?
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 40598956
create a form with a textbox named sometextbox and paste this code:

Public Class Form1

    Private Sub sometextbox_TextChanged(sender As Object, e As EventArgs) Handles sometextbox.TextChanged
        MyProperty = sometextbox.Text
    End Sub

    Private mstrMyProperty As String
    Private Property MyProperty() As String
        Get
            Return mstrMyProperty
        End Get
        Set(value As String)
            mstrMyProperty = value
            If Debugger.IsAttached Then Debugger.Break()
        End Set
    End Property
End Class

Open in new window


As soon as you will type in your textbox, the execution will break.
0
 
LVL 40
ID: 40599139
In some cases, you can simply set a condition to breakpoints located in strategic location. You won't get the exact place where the changes takes place (that is probably the only thing I miss from VB6), but if your breakpoints are located correctly, you might find what causes a specific problem.

To add a condition, simply right click on the red circle that identifies the breakpoint in the margin. You will find a few interesting ways to set the breakpoint, including one where you can set a condition for the break.
0
 

Author Closing Comment

by:MBHEY131
ID: 40599155
Thank You
That helped a lot took me right to the issue I could not find
not sure I've grasped the Get and Set properties yet but I'm learning
Call Stack does not work quite the same
I just got back into development from FoxPro 2.6 with just a little of VB6
Thanx again
Seems this is quite a step backword
2.6 and before the BREAK ON CHANGE was incorporated in the software and pretty easy to implement
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Samba is the de-facto standard program (or, more correctly: suite of programs) that UNIX and Linux systems use to share files with Microsoft Windows (and more recently, Mac OS-X) systems. Currently, there are 2 common versions of Samba available,…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

862 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

21 Experts available now in Live!

Get 1:1 Help Now