Sometimes Controls that have been added to a GroupBox do not show up.
What I am doing :
1) I am not using the designer, but create all the Controls per hand:
groupBoxProdukt_01 = new System.Windows.Forms.GroupBox();
etc. for all other Controls.
After setting Font and Text values I then add them to the Panel:
pnPanelControls.Controls.Add(groupBoxProdukt_01);
pnPanelControls.Controls.Add(groupBoxProdukt_02);
pnPanelControls.Controls.Add(groupBoxProdukt_03);
pnPanelControls.Controls.Add(groupBoxProdukt_04);
pnPanelControls.Controls.Add(groupBoxProdukt_05);
groupBoxProdukt_01.Controls.Add(comboBoxProdukt_Ar t);
groupBoxProdukt_01.Controls.Add(textBoxProdukt_Nam e);
groupBoxProdukt_01.Controls.Add(textBoxProdukt_Tex t);
groupBoxProdukt_02.Controls.Add(comboBoxProdukt_Li eferant);
groupBoxProdukt_02.Controls.Add(labelProdukt_Preis );
groupBoxProdukt_02.Controls.Add(textBoxProdukt_Pre is);
groupBoxProdukt_02.Controls.Add(labelProdukt_Unit) ;
groupBoxProdukt_03.Controls.Add(textBoxProdukt_Ver packung);
groupBoxProdukt_03.Controls.Add(comboBoxProdukt_Ve rpackung);
groupBoxProdukt_04.Controls.Add(textBoxProdukt_Hal tbarkeit);
groupBoxProdukt_04.Controls.Add(comboBoxProdukt_Ha ltbarkeit);
groupBoxProdukt_05.Controls.Add(labelProdukt_SollM enge);
groupBoxProdukt_05.Controls.Add(textBoxProdukt_Sol lMenge);
pnPanelControls.Controls.Add(button_Produkt_Shoppi ng);
etc for Controls of other Dialogs.
Attribute Visiable is set to false for all Controls.
An OnSize Method sets size and Location at run time. and the Controls that
should be shown are set to Visiable= true;
There are four different types of Dialogs, one of which, will be shown. The
above shown "Produkt" is one
with 5 GroupBoxes. The other Dialogs have one GroupeBox and show fine,
Produkt shows only the first
GroupBox with the desigered Controls. The other GroupBoxes are shown but are
empty. The Buttons outside the GroupBoxes also show.
When I first tried this I placed all Controls on to the Panel and the
Controls show up. But if I called another Dialog before "Produkt" and then
called Produkt then ALL the GroupBoxes where empty.
When setting the GroupBox to visiable=false, the Controls showed in the
proper position.
I found out that the Controls should be added to the GroupBox hoping this
would solve the problem.
But it works only with the first GroupBox and not the others that are set to
visable.
Mark Johnson, Berlin Germany
mj*****@mj10777.de