GiJeet said:
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/archiv...tudio-to-debug-net-framework-source-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 <YourButton> reference 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; }
}