private void RingMasterButton_Click(object sender, EventArgs e) { // Creating a new RingMaster object and checking that fields have values. RingMaster master = new RingMaster(NameBox.Text, (int)ClotheAmt.Value); if (NameBox.Text == "") { MessageBox.Show("Enter a name."); } else if (ClotheAmt.Value == 0) { MessageBox.Show("Enter a value above zero."); } // Adding new RingMaster object to masters array. if (count < 20 && NameBox.Text != "" && ClotheAmt.Value != 0) { masters[count] = master; count++; } else { MessageBox.Show("No more room."); } NameBox.ResetText(); ClotheAmt.ResetText(); }
private void RollCall_Click(object sender, EventArgs e) { // Displaying elements in masters array and clearing NameBox and ClotheAmt fields. for (int i = 0; i < masters.Length && masters[i] != null; i++) { MessageBox.Show(masters[i].Report()); } NameBox.ResetText(); ClotheAmt.ResetText(); }