By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

What happened to Watch Points?

P: n/a
In Vb6, there was a feature called (I think) watchpoint. You could set it
to break on a condition, such as when a control's Visible property was
changed.

I can't find this sort of breakpoint in VB.Net, is it there?

If not, I have a fairly complex project where a text box which is supposed
to be invisible is being set Visible somewhere. I've searched, and there
isn't any code doing it directly (e.g. txtPhone.Visible = True). I think
there's probably some code walking through the controls collection, setting
everything to visible, or something like that.

How could I track this type of siutation down without VB6's watchpoints?

Thanks,
---Selden
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Check the properties of a breakpoint. Create a breakpoint, right click it
and select properties. You should see a condition option.

Telmo Sampaio

"Selden McCabe" <se*****@msn.com> wrote in message
news:Ox**************@TK2MSFTNGP12.phx.gbl...
In Vb6, there was a feature called (I think) watchpoint. You could set it
to break on a condition, such as when a control's Visible property was
changed.

I can't find this sort of breakpoint in VB.Net, is it there?

If not, I have a fairly complex project where a text box which is supposed
to be invisible is being set Visible somewhere. I've searched, and there
isn't any code doing it directly (e.g. txtPhone.Visible = True). I think
there's probably some code walking through the controls collection, setting everything to visible, or something like that.

How could I track this type of siutation down without VB6's watchpoints?

Thanks,
---Selden

Nov 20 '05 #2

P: n/a
* "Telmo Sampaio" <ts******@gmail.com> scripsit:
Check the properties of a breakpoint. Create a breakpoint, right click it
and select properties. You should see a condition option.


I doubt that this is what the OP is looking for, because it would
require you to know the line of code that is changing the property.
If not, I have a fairly complex project where a text box which is supposed
to be invisible is being set Visible somewhere. I've searched, and there
isn't any code doing it directly (e.g. txtPhone.Visible = True). I think
there's probably some code walking through the controls collection,


--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a
Hi Telmo, Thanks for the reply.
I see the condition on the breakpoint.
But what if I don't have any idea WHERE the code is that's setting the
control's property?
Where would I set the breakpoint?

Anyway, I added some code to the VisibleChanged event for the control, set a
break point there, and found it that way.

---Selden
Nov 20 '05 #4

P: n/a
Yes and no.
Place a breakpoint on the MessageBox line of button2_click and set its
condition to *when x has changed*. Althoug X is changed in the button1_click
method the breakpoint in button2_click will occur.
Dim x As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

x += 1

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim y As Integer

y += x

MessageBox.Show(y)

End Sub

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
* "Telmo Sampaio" <ts******@gmail.com> scripsit:
Check the properties of a breakpoint. Create a breakpoint, right click it
and select properties. You should see a condition option.


I doubt that this is what the OP is looking for, because it would
require you to know the line of code that is changing the property.
If not, I have a fairly complex project where a text box which is supposed to be invisible is being set Visible somewhere. I've searched, and there isn't any code doing it directly (e.g. txtPhone.Visible = True). I think there's probably some code walking through the controls collection,


--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

P: n/a
That's the problem, you need to specify a place for the breakpoint. I just
posted an answer to Herfried about this, using two buttons and making the
change on button1 and breaking on button2. Again, it is not perfect, but it
is the only way I know for doing what a watch condition did in VB6.

Telmo Sampaio

"Selden McCabe" <se*****@msn.com> wrote in message
news:#6**************@TK2MSFTNGP09.phx.gbl...
Hi Telmo, Thanks for the reply.
I see the condition on the breakpoint.
But what if I don't have any idea WHERE the code is that's setting the
control's property?
Where would I set the breakpoint?

Anyway, I added some code to the VisibleChanged event for the control, set a break point there, and found it that way.

---Selden

Nov 20 '05 #6

P: n/a
Thanks Telmo, for this information.

This looks pretty cool, I didn't know you could do that with a breakpoint!

I tried setting this up by setting a breakpoint on one line of code in the
form, and then set the condition to:

txtPhone.Visible

has changed.

When I ran the project, the textbox went from not visible to visible, but
the breakpoint didn't get hit.

Can you think of any restrictions on what line of code you put the
breakpoint on?

My first attempt was in an unrelated module (not the form that contains the
text box) and it complained that it couldn't set the breakpoint.
(I had set the condition to "frmConsumer.txtPhone.Visible" - similar to the
way it worked in VB6).

So obviously the breakpoint must be somewhere where the variable is in
scope.

Or maybe this just doesn't work for properties of controls?

Anyhow, thanks again for the advice, I've already learned something new
about breakpoints!

---Selden
Nov 20 '05 #7

P: n/a
* "Telmo Sampaio" <ts******@gmail.com> scripsit:
Place a breakpoint on the MessageBox line of button2_click and set its
condition to *when x has changed*. Althoug X is changed in the button1_click
method the breakpoint in button2_click will occur.


OK, that would work indeed.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.