private void btnAdd_Click(object sender, EventArgs e) { string name = tbName.Text; float grade = 0; try { grade = float.Parse(tbGrade.Text); }catch (Exception) { MessageBox.Show("form contains errors"); } string cnp = tbCnp.Text; string option = comboBox1.Text; Candidate candidate = new Candidate(name, grade, cnp); if (option == "Licence") { licence += candidate; } else if (option == "Master") { master += candidate; } else { MessageBox.Show("Select a type!"); } }
public Form1() { InitializeComponent(); licence = new Licence(); master = new Master(); }
public ViewForm(Licence licence, Master master) { this.licence = licence; this.master = master; InitializeComponent(); }