private void button1_Click(object sender, EventArgs e) { PassingValues.NumberOfNights = txtNumberOfNights.Text; PassingValues.NumberOfAdults = txtNumberOfAdults.Text; PassingValues.NumberOfChildren = txtNumberOfChildren.Text; PassingValues.NumberOfRooms = txtNumberOfRooms.Text; PassingValues.TotalAmount = lblTotalCost.Text; Customer_Payment payment = new Customer_Payment(); payment.Height = this.Height; payment.Width = this.Width; payment.MdiParent = this.MdiParent; this.Hide(); payment.Show(); }
private void bOk_Click(object sender, EventArgs e) { int flag = 0; string[] AdultsInfo = new string[adults * 2]; string[] ChildrenInfo = new string[children * 2]; // Array Customer_Name, Customer_Ages; foreach (Control c in this.Controls) { if (c is TableLayoutPanel) { foreach (Control c2 in c.Controls) { if (c2 is TextBox) { if (c2.Text == "") { // c2.BackColor = Color.Red; flag = 1; } // MessageBox.Show(c2.Text); } } } } if (flag == 1) { MessageBox.Show("Please provide All the Details"); } else { int i; foreach (Control c in this.Controls) { if (c is TableLayoutPanel) { i = 0; if (c.Name == "tableLayoutAdults") { foreach (Control c2 in c.Controls) { if (c2 is TextBox) { AdultsInfo[i] = c2.Text; i++; // MessageBox.Show(c2.Text); } } } else { i = 0; foreach (Control c2 in c.Controls) { if (c2 is TextBox) { // Customer_Names[i]=c2.Text; ChildrenInfo[i] = c2.Text; i++; // MessageBox.Show(c2.Text); } } } } } Customer_Payment pay = new Customer_Payment(AdultsInfo, ChildrenInfo); MessageBox.Show(AdultsInfo.Length + " " + ChildrenInfo.Length); pay.MdiParent = this.MdiParent; pay.Show(); } }