How to show different textBox on a winform just by selecting the comboBox in C#? RRS feed

  • Question

  • On a winform, I have a comboBox and some textBox. My comboBox got two selection let say Format A and Format B. What I want to do is when I select Format A, the winform will show only TextBox A. And when I select Format B, the winform will show only TextBox B. TextBox A and TextBox B will not appeared together. How am I going to do this?

    I've tried textBox.Enabled, but this command only make the textBox enable or disable. It will still show on the winform. How to make the textBox completely disappeared? What I mean is, if textBox A appear, textBox B disappeared. When textBox B appear, textBox A disappeared.

    • Edited by maniac7713 Wednesday, August 8, 2012 11:21 AM
    Wednesday, August 8, 2012 11:20 AM


  • Hi,

    maybe you are looking for the visible Property: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.visible.aspx.

    With kind regards,


    • Proposed as answer by Mike Feng Friday, August 10, 2012 10:13 AM
    • Marked as answer by Mike Feng Thursday, August 16, 2012 9:36 AM
    Wednesday, August 8, 2012 12:07 PM