private void EmployeeAddAddButton_Click(object sender, EventArgs e) { if (ErrorCheck()) { return; } EmployeAddNameTextbox.Text = EmployeAddNameTextbox.Text.TrimAndRemoveWhiteSpaces().AllFirstLettersToUpper(); EmployeeAddSurnameTextbox.Text = EmployeeAddSurnameTextbox.Text.TrimAndRemoveWhiteSpaces().AllFirstLettersToUpper(); var CheckedNames = new List <string>(); foreach (var ProjectProperties in EmployeePositioncheckedListBox.CheckedItems) { CheckedNames.Add(ProjectProperties.ToString().GetProjectNameInCheck()); } if (!RemoveUncheckedProjects()) { return; } AddProjectsToEmployee(CheckedNames); EmployeesList.EmployeeDelete(EmployeesList.FindEmployeeByOIB(OldOIB)); UpdateOIB(); EmployeesList.AddEmployee(EmployeAddNameTextbox.Text, EmployeeAddSurnameTextbox.Text, EmployeeAddDateTimePicker.Value, EmployeeAddOIBTextbox.Text, (CompanyPositions)Enum.Parse(typeof(CompanyPositions), EmployeeAddcomboBox.Text)); Close(); }