public static void RadioButtonCheckedChanged() { System.Windows.Forms.GroupBox[] tempGroupBox = cashierScreen.GetGroupBoxes(); for (int i = 0; i < 3; i++) { foreach (RadioButton r in tempGroupBox[i].Controls.OfType <RadioButton>()) { if (r.Checked) { string text = r.Text; // Set the selection label equal to this text as well foreach (TextBox t in tempGroupBox[i].Controls.OfType <TextBox>()) { if (!t.Enabled) // Only the price textbox is disabled { t.Text = String.Format("{0:C2}", GetPrice(text)); foreach (Label l in tempGroupBox[i].Controls.OfType <Label>()) { string tempName = "lblSelection" + i; //System.Diagnostics.Debug.Print(tempName); //System.Diagnostics.Debug.Print(l.Name); if (l.Name.Equals(tempName)) { switch (i) { case 0: // Salads l.Text = "Salad Selection: " + r.Text; break; case 1: // Salads l.Text = "Drink Selection: " + r.Text; break; case 2: // Salads l.Text = "Dessert Selection: " + r.Text; break; } } } } } } } } }