my application workes perfectly fine on win xp, but doesn't show some of the labels and text boxes on win 7 or vista (these controls that doen't show are on a panel that was created by code - the one's on the form are fine)
Code:
for (int j = Drinks.Count - 2; j >= Index; j--)
{
p = new Point(3, 3 + hGap * (j + 1));
for (i = 0; i < Drinks.Count && pnlDrinks.Controls[i].Name.CompareTo("pnlDrink" + j) != 0; i++) ;
pnlDrinks.Controls[i].Location = p;
pnlDrinks.Controls[i].Name = "pnlDrink" + (j + 1);
}
Label lblDrinkNo = new Label();
lblDrinkNo.AutoSize = true;
lblDrinkNo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(177)));
lblDrinkNo.Location = new System.Drawing.Point(9, 9);
lblDrinkNo.Name = "lblDrinkNo";
lblDrinkNo.Size = new System.Drawing.Size(61, 13);
lblDrinkNo.TabIndex = 0;
lblDrinkNo.Text = "Drink No.";
TextBox txtDrinkNo = new TextBox();
txtDrinkNo.Location = new System.Drawing.Point(71, 6);
txtDrinkNo.Name = "txtDrinkNo";
txtDrinkNo.Text = drinkNo.ToString();
txtDrinkNo.Size = new System.Drawing.Size(27, 20);
txtDrinkNo.TabIndex = 41;
txtDrinkNo.Enabled = false;
Label lblDrinkPrice = new Label();
lblDrinkPrice.AutoSize = true;
lblDrinkPrice.Location = new System.Drawing.Point(139, 9);
lblDrinkPrice.Name = "lblDrinkPrice";
lblDrinkPrice.Size = new System.Drawing.Size(59, 13);
lblDrinkPrice.TabIndex = 2;
lblDrinkPrice.Text = "Drink Price";
TextBox txtDrinkPrice = new TextBox();
txtDrinkPrice.Location = new System.Drawing.Point(203, 6);
txtDrinkPrice.Name = "txtDrinkPrice";
txtDrinkPrice.Size = new System.Drawing.Size(32, 20);
txtDrinkPrice.TabIndex = 41;
txtDrinkPrice.Text = "00";
txtDrinkPrice.LostFocus += new System.EventHandler(PriceCheckValidity);
Label lblDrinkName = new Label();
lblDrinkName.AutoSize = true;
lblDrinkName.Location = new System.Drawing.Point(302, 8);
lblDrinkName.Name = "lblDrinkName";
lblDrinkName.Size = new System.Drawing.Size(63, 13);
lblDrinkName.TabIndex = 40;
lblDrinkName.Text = "Drink Name";
TextBox txtDrinkName = new TextBox();
txtDrinkName.Location = new System.Drawing.Point(369, 6);
txtDrinkName.Name = "txtDrinkName";
txtDrinkName.Size = new System.Drawing.Size(194, 20);
txtDrinkName.TabIndex = 41;
Label label6 = new Label();
label6.AutoSize = true;
label6.Location = new System.Drawing.Point(3, 3);
label6.Name = "lblSteps";
label6.Size = new System.Drawing.Size(34, 13);
label6.TabIndex = 30;
label6.Text = "Steps";
Panel pnlSteps = new Panel();
pnlSteps.AutoScroll = true;
pnlSteps.Controls.Add(label6);
pnlSteps.Location = new System.Drawing.Point(0, 30);
pnlSteps.Name = "pnlSteps";
pnlSteps.Size = new System.Drawing.Size(995, 38);
pnlSteps.TabIndex = 43;
hStartP = 1;
szLbl = new Size(19, 2);
wStartP = 43;
wGap = 120;
szTxt = new Size(70, 2);
for (i = 0; i < 32; i++)
{
c = new TextBox();
p = new Point(wStartP + i * wGap, hStartP);
c.Location = p;
c.Name = LBL_STEP + i;
c.Text = (i + 1).ToString();
c.Size = szLbl;
c.Enabled = false;
pnlSteps.Controls.Add(c);
c = new TextBox();
p = new Point(wStartP + 18 + i * wGap, hStartP);
c.Location = p;
c.Name = TXT_INGRD + i;
c.Size = szTxt;
c.Enter += new System.EventHandler(IngrdSaveLast);
c.LostFocus += new System.EventHandler(IngrdCheckValidity);
pnlSteps.Controls.Add(c);
p = new Point(wStartP + 18 + 69 + i * wGap, hStartP);
c = new TextBox();
c.Location = p;
c.Name = TXT_QTY + (i);
c.Size = szLbl;
c.LostFocus += new System.EventHandler(QtyCheckValidity);
pnlSteps.Controls.Add(c);
}
hGap = 75;
pnl = new Panel();
pnl.SuspendLayout();
pnlDrinks.Controls.Add(pnl);
pnl.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
pnl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
pnl.Controls.Add(lblDrinkNo);
pnl.Controls.Add(txtDrinkNo);
pnl.Controls.Add(lblDrinkPrice);
pnl.Controls.Add(txtDrinkPrice);
pnl.Controls.Add(lblDrinkName);
pnl.Controls.Add(txtDrinkName);
pnl.Controls.Add(pnlSteps);
pnl.Location = new System.Drawing.Point(3, 3 + hGap * Index);
pnl.Name = "pnlDrink" + Index;
pnl.Size = new System.Drawing.Size(995, 71);
pnl.TabIndex = 48;