?
Solved

break when a value changes

Posted on 2015-02-09
5
Medium Priority
?
115 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 70

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 70

Accepted Solution

by:
Éric Moreau earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Problem: Windows 32bit running out of paging space. Solution: Add additional page files on separate partitions. Background: By default Windows creates only one page file on the partition you install Windows on. You may know that the maximu…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 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