Error Provider in C# - Csharp

How to use error provider in C#

Snippet Code


  
Rate this page :
  [ 1 votes]

Here, the code explains how to validate empty string using error provider in c#

private void txtEmptyString_Validated(object sender, EventArgs e) { bool bTest = txtEmptyStringIsValid(); if (bTest == true) { this.errorProvider1.SetError(txtEmptyString, "This field must contain text"); } else { this.errorProvider1.SetError(txtEmptyString, ""); } }

Tags


Ask Questions

Ask Question