public void loadPaymentTypes() { tcPaymentTypes.TabPages.Clear(); dtPaymentTypes = paymenttypec.loadPaymentType("payment"); foreach (DataRow row in dtPaymentTypes.Rows) { TabPage tp = new TabPage(); tp.Text = row["description"].ToString(); tp.Name = "tp_" + row["description"].ToString().Replace(" ", ""); Panel panel = new Panel(); panel.Name = "pn_" + row["description"].ToString().Replace(" ", ""); panel.Dock = DockStyle.Fill; tp.Controls.Add(panel); tcPaymentTypes.TabPages.Add(tp); } DataRow row2 = dtPaymentTypes.Rows[0]; string pnName = "pn_" + row2["description"].ToString().Replace(" ", ""); Panel panelFind = this.Controls.Find(pnName, true).FirstOrDefault() as Panel; forSAPIP2 forsapip2 = new forSAPIP2(gSalesType, gForType); forsapip2.TopLevel = false; panelFind.Controls.Clear(); panelFind.Controls.Add(forsapip2); forsapip2.BringToFront(); forsapip2.Show(); cTabs = 0; }
private void tcPaymentTypes_SelectedIndexChanged(object sender, EventArgs e) { //loop mo tabpages then pass mo sa forsapip2 yung text if (cTabs <= 0) { string description = tcPaymentTypes.SelectedTab.Text; string pnName = "pn_" + description.Replace(" ", ""); string code = findPaymentTypesData(description); Panel panelFind = this.Controls.Find(pnName, true).FirstOrDefault() as Panel; forSAPIP2 forsapip2 = new forSAPIP2(gSalesType, gForType); forsapip2.TopLevel = false; panelFind.Controls.Clear(); panelFind.Controls.Add(forsapip2); forsapip2.BringToFront(); forsapip2.Show(); } }