Header Ads

Header ADS

Validation Source Code C#.Net WinForms

 private bool Validation()

{

    bool result = false;

    if (string.IsNullOrEmpty(textBox1.Text))

    {

        errorProvider1.Clear();

        errorProvider1.SetError(textBox1, "Product Id Required");

    }

    else if (string.IsNullOrEmpty(textBox2.Text))

    {

        errorProvider1.Clear();

        errorProvider1.SetError(textBox2, "Product Name Required");

    }

    else if (string.IsNullOrEmpty(textBox3.Text))

    {

        errorProvider1.Clear();

        errorProvider1.SetError(textBox3, "Price Required");

    }

    else if (string.IsNullOrEmpty(textBox4.Text))

    {

        errorProvider1.Clear();

        errorProvider1.SetError(textBox4, "Quantity Required");

    }

    else

    {

        result = true;

    }

    return result;

}

No comments

Powered by Blogger.