private bool isFormValid() { if (StudentNameTextBox.Text.Trim() == string.Empty) { SMSMessageBox.ShowErrorMessage("Name is required"); StudentNameTextBox.Focus(); return(false); } if (PhoneNumberTextBox.Text.Trim() == string.Empty) { SMSMessageBox.ShowErrorMessage("Phone number is required"); PhoneNumberTextBox.Focus(); return(false); } if (DepartmentComboBox.SelectedIndex == -1) { SMSMessageBox.ShowErrorMessage("Department is required"); DepartmentComboBox.Focus(); return(false); } return(true); }
private bool IsFormValid() { if (StudentNameTextBox.Text.Trim() == string.Empty) { MessageBox.Show("Student name is Required.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); StudentNameTextBox.Focus(); return(false); } if (StudentNameTextBox.Text.Length >= 200) { MessageBox.Show("Student Name length should be less than or equal to 200 characters.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error); StudentNameTextBox.Focus(); return(false); } return(true); }
private void ResetFormControl() { StudentNameTextBox.Clear(); AgeTextBox.Clear(); GenderTextBox.Clear(); DescriptionTextBox.Clear(); IdPictureBox.Dispose(); StudentNameTextBox.Focus(); if (this.IsUpdate) { this.StudentId = 0; this.IsUpdate = false; SaveButton.Text = "Save User Information"; DeleteButton.Enabled = false; ViewStudentForm vsf = new ViewStudentForm(); //vsf.LoadDataIntoDataGridView(); vsf.StudentDataGridView.Refresh(); } }