Bind a button's enabled property to a custom object

  • Thread starter Thread starter moondaddy
  • Start date Start date
M

moondaddy

I have a group of buttons which I want to bind thier enabled properties to
properties of a custom object (all of which will be boolean value types).
How do I do this?
 
moondaddy said:
I forgot to mention that this is a c# winforms 2.0 app.



moondaddy said:
I have a group of buttons which I want to bind thier enabled properties to
properties of a custom object (all of which will be boolean value types).
How do I do this?

Try something like this:

this.button1.DataBindings.Add(new Binding("Enabled",
this.yourCustomObjectInstance, "BooleanPropertyName"));
 
moondaddy said:
I forgot to mention that this is a c# winforms 2.0 app.



moondaddy said:
I have a group of buttons which I want to bind thier enabled properties to
properties of a custom object (all of which will be boolean value types).
How do I do this?
You could try

buttonName.DataBindings.Add("Enabled", CustomBusinessObject,
"BooleanPropertyName");
 
Back
Top