473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Debugging - how to track a button visibility change and stop programexecution

I put the the button property in the watch window but it doesn't stop
when the property changes value. For example I put
this.myButton.Visible in the watch window with an initial value of
false and I want program execution to stop when the Visible property
changes to true. how to accomplish this?

TIA
G
Oct 27 '08 #1
3 2684

"GiJeet" wrote:
I put the the button property in the watch window but it doesn't stop
when the property changes value. For example I put
this.myButton.Visible in the watch window with an initial value of
false and I want program execution to stop when the Visible property
changes to true. how to accomplish this?

TIA
G
Eh,

Are you talking about an advanced breakpoint functionality? The watch
window doesn't cause breakpoints to happen, and unless your program is inside
a breakpoint the watch window is disabled.

If your goal is to break into the program when a button's visibility
property is set to true or false you have several options.

Using Visual Studio 2008 you can download the source code for
System.Windows.Forms.dll and set a breakpoint on the Control.Visible property
(or some code called by this property as I had code mismatch and had to set
the breakpoint on SetVisibleCore). For instructions on how to download
framework source read these articles:

[How to: Debug .NET Framework Source]
http://msdn.microsoft.com/en-us/library/cc667410.aspx

[Configuring Visual Studio to Debug .NET Framework Source Code]
http://blogs.msdn.com/sburke/archive...urce-code.aspx

You can also create your own Button and create a Visible property on it. As
long as you call this property as a <YourButtonreference you can set a
breakpoint in it.

class MyButton : Button
{
public new bool Visible
{
get { return base.Visible; }
set { base.Visible = value; }
}
}

You can databind the Visible property on the Button to a property of your
own and set a breakpoint on the property setter.
button1.DataBindings.Add("Visible", this, "SomeProperty", false,
DataSourceUpdateMode.OnPropertyChanged);

....

private bool _someProperty;
public bool SomeProperty
{
get { return _someProperty; }
set { _someProperty = value; }
}

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 28 '08 #2
"GiJeet" <gi****@yahoo.comwrote in message
news:23**********************************@k16g2000 hsf.googlegroups.com...
>I put the the button property in the watch window but it doesn't stop
when the property changes value. For example I put
this.myButton.Visible in the watch window with an initial value of
false and I want program execution to stop when the Visible property
changes to true. how to accomplish this?
If you're looking for the VB6 functionality of "break when this value
changes," you can forget about it. The .NET IDEs don't have the same
concept. You have to put breakpoints anywhere the value might change. Your
first thought is probably "Why did they remove this?! It was so handy!" I
agree, I agree.
Oct 28 '08 #3
>On Oct 28, 9:41*am, "Jeff Johnson" <i....@enough.spamwrote:
If you're looking for the VB6 functionality of "break when this value
changes," you can forget about it. The .NET IDEs don't have the same
concept. You have to put breakpoints anywhere the value might change. Your
first thought is probably "Why did they remove this?! It was so handy!" I
agree, I agree.
Yes that's what I was looking for. Hmmm.... the whole point of
tracking when something chages is...YOU DON'T KNOW WHEN IT CHANGED AND
YOU ARE TRYING TO FIND THAT POINT IN THE CODE. This is a real
setback....

Nov 3 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Søren Johansen | last post by:
Hi, I am getting a stack overflow exception. I was wondering how to to debug this situation with vc. I know that the problem is not based on (unintended or intended) recursion and the call...
8
by: Matt Theule | last post by:
While stepping through an ASP.NET project, I found that data was being inserted into my database even though I was not stepping through the code that inserted the data. I have a single page with...
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
1
by: Jeffrey Frabutt | last post by:
Hey... I'm reletively new to ASP.NET and am having some frustrating debugging issues. Everything is configured correctly for me to debug my VERY simple one-page application. That said, after just...
6
by: KevinGPO | last post by:
I am currently developing a website in ASP (VBScript) using MS Visual C#.NET IDE. I just create a new "ASP.NET Web Application" and point to my local webserver (IIS) of my website address. Then I...
0
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the...
17
by: govolsbaby | last post by:
Is there a way to leave the button forecolor unchanged when it is disabled? I have multiple buttons on the form and depending on various user inputs, some will or will not be enabled but I'd...
1
by: GiJeet | last post by:
Hello, I'm trying to stop program execution by setting a break point and setting a condition on a variable. So I go into the breakpoints window and set a condition e.g. when 'x1' has changed. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.