• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 120
  • Last Modified:

break when a value changes

vb.net
vs2012

I want to tell the debugger to stop when a value of "sometextbox.text"  changes
how do I do it?
0
MBHEY131
Asked:
MBHEY131
  • 2
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
MBHEY131Author Commented:
I have no Idea how to even start to accomplish that?
0
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
Jacques Bourgeois (James Burger)Commented:
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
 
MBHEY131Author Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now