Group Box Visibility

Hi,

I have two group boxes on a form both with additional group boxes, radio buttons, combo boxes, etc inside them. GroupBox1 has the visible property set to true in the properties window. GroupBox2 has the visible property set to false in the properties window. I use two command buttons to toggle the visibility of the two group boxes. My problem is this:

1. Even though the visible property is set to false in the properies window, GroupBox2 is still displayed when the form loads. Toggling the command buttons does show and hide the two GroupBoxes correctly when the two group boxes are not stacked on top of each in design mode.

2. When the two group boxes are stacked on top of each other at the same location in design mode, GroupBox2 does not display at all. GroupBox1 displays just fine. I had to call LockWindowUpdate to get the outline of GroupBox2 to display.

3. When I set the GroupBox2 visible property to false in Form Load, GroupBox2 is hidden. When I toggle the command button to hide GroupBox1 and show GroupBox2, only the outline for GroupBox2 appears. None of the controls inside GroupBox2 are visible. When I toggle the command button again, GroupBox1 displays just fine.

I am a long time VB6 programmer and this is an app I upgraded. I am stumped on some of what should be the simplest things. Any help would be appreciated.

Lisa Shanley



Answer this question

Group Box Visibility

  • Jim Sn

    Hi Lisa. It's always pleasant to see another woman here.

    " Toggling the command buttons does show and hide the two GroupBoxes correctly when the two group boxes are not stacked on top of each in design mode."

    I found this to be really curious. Since that's the simplest, least ambiguous case, this is where I would begin.

    Also on the visibility .. just to make sure I'd define the world this way"

    Groupbox1.visible = whatever
    Groupbox2.visible = Not Groupbox1.visible

    If this is a big piece of code from a conversion it may not do us any good to see code.

    But I'd do for the simplest, least ambiguous case possible first and I'm sure you know this.

    There could be any number of things doing this. I'd go for simplicity first.



  • Group Box Visibility