private void Button1_Click(object sender, System.EventArgs e) { form2.ShowDialog(); Category category = new Category(); category.Name = form2.textBox1.Text; category.Description = form2.textBox2.Text; if (category.IsValid()) { service.AddCategory(category); catNode = new TreeNode(category.Name); rootNode.Nodes.Add(catNode); } else { string Errors = null; for (int i = 0; i < category.Errors.Count; i++) { Errors += category.Errors[i] + "\n"; } MessageBox.Show(Errors); } }