Solved

break when a value changes

Posted on 2015-02-09
5
91 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
Comment Utility
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
Comment Utility
I have no Idea how to even start to accomplish that?
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
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

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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
Comment Utility
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

Wish Marketing would stop bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

Join & Write a Comment

Suggested Solutions

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…
Introduction People like FTP.  It's a solid, stable, robust protocol for quickly transferring files between two hosts using TCP/IP.  In most cases it's much faster than SMB or CIFS, and certainly much easier to set up between organizations.  This…
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 keystrokes in Netbeans IDE 8.0 for Windows.

743 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

15 Experts available now in Live!

Get 1:1 Help Now