/// <summary> /// Deletes contact information in the list and ListBox. /// </summary> private void RemoveContact() { var selectedIndex = AllContactsListBox.SelectedIndex; if (selectedIndex == -1) { MessageBox.Show("Select a contact from the list", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; //TODO: если после if-else нет никакой общей логики, тогда в if можно написать return, а else с лишней вложенностью убрать (+) } DialogResult result = MessageBox.Show("Do you really want to remove this contact?", "Remove contact", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { var selectedContact = _contacts[selectedIndex]; _project.Contacts.Remove(selectedContact); AllContactsListBox.Items.RemoveAt(selectedIndex); SurnameTextBox.Clear(); NameTextBox.Clear(); PhoneTextBox.Clear(); EmailTextBox.Clear(); VkIDTextBox.Clear(); SaveToFile(); } SortingFoundContacts(); }
/// <summary> /// Clears all Text boxes /// </summary> private void ClearTextBoxes() { SurnameTextBox.Clear(); NameTextBox.Clear(); BirthdayDateTimePicker.Value = BirthdayDateTimePicker.MinDate; PhoneMaskedTextBox.Clear(); EmailTextBox.Clear(); VkTextBox.Clear(); }
private void ClearAllInputs() { userNameTextBox.Clear(); passwordTextBox.Clear(); NameTextBox.Clear(); SurnameTextBox.Clear(); registerUserNameTextBox.Clear(); registerPasswordTextBox.Clear(); confirmTextBox.Clear(); }
private void Reset() { UserNameTextBox.Clear(); PasswordTextBox.Clear(); NameTextBox.Clear(); SecondNameTextBox.Clear(); SurnameTextBox.Clear(); BirthDayDatePicker.ClearValue(DatePicker.SelectedDateProperty); SexComboBox.ClearValue(ComboBox.SelectedItemProperty); PositionComboBox.ClearValue(ComboBox.SelectedItemProperty); }
internal void RefreshTabEmployee() { employeeBindingSource.Clear(); for (int i = 0; i < manager.Employees.Count; i++) { employeeBindingSource.Add(manager.Employees[i]); } NameTextBox.Clear(); SurnameTextBox.Clear(); EmployeeDateTimePicker.Value = DateTime.Now; SalaryTextBox.Clear(); EmployeeDataGridView.ClearSelection(); }
private void AddToQueueButton_Click(object sender, EventArgs e) { if (!FirstNameIsCorrect() || !LastNameIsCorrect() || !AgeIsCorrect()) { return; } _eq.AddToElectronicQueue(new Person(NameTextBox.Text, SurnameTextBox.Text, int.Parse(AgeTextBox.Text))); NameTextBox.Clear(); SurnameTextBox.Clear(); AgeTextBox.Clear(); }
private void ResetAll() { NameTextBox.Clear(); SurnameTextBox.Clear(); foreach (RadioButton rb in AcademicGroupBox.Controls) { rb.Checked = false; } foreach (CheckBox cb in HobbiesGroupBox.Controls) { cb.Checked = false; } AcademicLevelsRichTextBox.Clear(); }