stu nicholls dot com | menu - Professional dropdown #3

Types of Validation

An application processes information entered by the user. Data validation ensures that the data entered in the application is accurate and of a valid data type. The inbuilt controls also support some methods and events that are useful for verification and validation of data

Data Validation
Field Level validation

Data in the fields are verified field by field, after the user enters the value into the field and moves onto the next field on the form. The values entered in different fields are verified with respect to data type, format, validity etc.

Using the ErrorProvider class
  • The ErrorProvider class gives you a user interface when you want to indicate that there’s as an error message in the icon’s tool tip
  • Following is the inheritance hierarchy of this class
    System.object
    System.Marshal.ByRefObject
    System.ComponentModel.Component
    System.Windows.Forms.ErrorProvider
Public Properties of ErroProvider objects
  • Blink Rate: Gets/sets the error icon blink rate
  • Blink Style: Gets/sets if the error icon flashes
  • ContainerControl: Gets/sets the parent control for this error provider
  • DataMember: Gets/sets the data table to watch
  • DataSource: Gets/sets dataset to watch
  • Icon: Gets/sets the icon to be displayed next to a control when you have assigned a non empty string to the error provider
Public methods of Error Provider class
  • BindToDataErrors: sets both the DataSource and DataMember properties at run time
  • GetError: Returns the error description string
  • GetIconAlignment: Gets the position of the error icon with respect to the control
  • GetIconPadding: Gets the space to leave next to the icon
  • SetError: sets the error text
  • SetIconAlignment: Sets the position of the error icon with respect to the text box
  • SetIconPadding: Sets the space to leave next to the icon
  • UpdateBinding: Lets you update the data binding and the text in the error provider

Next>>Performing Data Validation


comments powered by Disqus
Footer1