Search code examples
c#winformsvisible

Buttons that are initially invisible


I am making a 'window form app' on c# app. I have couple of buttons and text boxes. What I want is that when I run app for the first time some buttons and text boxes are invisible. And After I click a certain button those buttons and text boxes become visible.

At the moment when I run app every thing (buttons and textboxes) is visible on the form initially. I can make them visible and invisible after pressing a button or so but initially every thing is visible.


Solution

  • Every Button class has a Visible property, just set it to true or false, to show the button or hide it accordingly.

    • first from PropertyGrid set Visible property to false (for those buttons that should not be visible on startup)

    • handle click on others

    • on click of one of them (based on your app logic) make =>

    (example)

    btnMyInvisibleButton.Visible = true;