UI Field Validation in WPF

UI field validation in WPF is a one of most important. Because when the field can't get the Specific class then it will get Error. So it better to create a CheckField()  for specific Button Event & there you can implement the method as:

/******************* A Button Event *****************/
         private void appointAddButton_Click(object sender, RoutedEventArgs e)

     /************** Implement AddAppointmentInListView Method*****************/
        private void AddAppointmentInListView()
                if (CheckField())
                    EAppointment objAppointment = new EAppointment();
                    objAppointment.TrackNo = Convert.ToInt64(employeeTrackNoTextBox.Text);
                    objAppointment.InterviewId = Convert.ToInt64(employeeIdTextBox.Text);
                    objAppointment.AppointmentDate =  appointDateDateTimePicker.SelectedDate.Value;
                    List<EAppointment> listAppoint = new List<EAppointment>();
                    objAppointment.AppointList = listAppoint;
            catch (Exception e)
  /************* Implement CheckField Method************/
 /********* Note that you should Declare raiseKeyUp as Global********
/******** private bool raiseKeyUp = true; ********/
     private bool CheckField()
            if (employeeTrackNoTextBox.Text.Trim() == string.Empty)
                MessageBox.Show("Please enter Track Number", "IEMS", MessageBoxButton.OK);
                this.raiseKeyUp = false;
                return false;
                             return true;

  You can also Make your Validation Field more Glossy if you download the Code from the link:


  Now see what happen in your validation. Enjoy......!!

Popular posts from this blog

mvc razor textboxfor change event change another textboxfor value

WPF Crystal Report Viewer Using SAP

ASP.NET MVC razor SAP Crystal report