private void btnCreate_Click(object sender, EventArgs e) { if (txtAddress.Text == "" || txtCode.Text == "" || txtFullName.Text == "") { MessageBox.Show("Required fields"); } else { Employee employee = new Employee(Int32.Parse(txtCode.Text), txtFullName.Text, txtAddress.Text); if (DBConnection.insertEmployee(employee)) { MessageBox.Show("Employee created succesfully"); this.Close(); } else { MessageBox.Show("This employee code is used"); } } }