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 bool ValidateForm() { if (!Regex.Match(TitleTextBox.Text, @"^\D{1,25}$").Success) { MessageBox.Show("Title must consist of at least 1 character and nod exceed 25 characters!"); TitleTextBox.Focus(); return(false); } if (!Regex.Match(SalaryTextBox.Text, @"^[0-9]*(?:\,[0-9]*)?$").Success) { MessageBox.Show("Invalid salary! Check the data you've entered!"); SalaryTextBox.Focus(); return(false); } return(true); }
private void ScenarioReset(object sender, RoutedEventArgs e) { _employee.Name = "Jane Doe"; _employee.Organization = "Contoso"; _employee.Age = null; //To reset Bindings with NullTargetValue and FallbackValue is necessary to reassign the Bindings BindingExpression ageBindingExp = AgeTextBox.GetBindingExpression(TextBox.TextProperty); Binding ageBinding = ageBindingExp.ParentBinding; AgeTextBox.SetBinding(TextBox.TextProperty, ageBinding); BindingExpression salaryBindingExp = SalaryTextBox.GetBindingExpression(TextBox.TextProperty); Binding salaryBinding = salaryBindingExp.ParentBinding; SalaryTextBox.SetBinding(TextBox.TextProperty, salaryBinding); tbBoundDataModelStatus.Text = ""; }