0

This is just a generic question related to C# and WinForm..

Is there any way to automatically trigger visibility of a control based on the count.. For example, I have a Boolean count which could be true or false.. If the count is True I need to hide some control and if its false I need to show the control.

Is it possible that changing the value of Boolean control can trigger the visibility function automatically? So that there is no actual call of Show / Hide control.. When the count value changes it automatically triggers the function which checks for the count value and shows/hide the control?

user1821499
  • 301
  • 4
  • 22

1 Answers1

0

At some point, there WILL be a call to Show() or Hide() or changing .Visible.

You can, in the designer, bind the control's .Visible property to the Count property (seriously reconsider the name for this) on your object. But that will really just pre-write the code for you.

When are you loading your object that has this boolean-count property? You could change the visiblilty of anything you like at that point.

Or, you could change the visiblity when your user edits the object you're presenting.

hometoast
  • 11,522
  • 5
  • 41
  • 58
  • related: http://stackoverflow.com/questions/22349162/visual-studio-winform-designer-set-databindings-on-current-control-bindingsourc – hometoast Apr 11 '14 at 18:39