Translate

> > C# Using Error Provider

C# Using Error Provider

Posted on Sunday, May 1, 2011 | No Comments

private bool saveFlag =true;
        bool addnewFlag =false;


duplicateCheck();
                if (saveFlag)
                {



        }



public void duplicateCheck()
        {
            if (addnewFlag)
            {
                DAL.DataSetErrotProviderTableAdapters.item_catagoryTableAdapter AdapterCategory = new Hardware_Inventory.DAL.DataSetErrotProviderTableAdapters.item_catagoryTableAdapter();
                DataTable dt = AdapterCategory.GetData(item_catagory_nameTextBox.Text);
                if (dt.Rows.Count > 0)
                {
                    errorProvider1.SetError(item_catagory_nameTextBox, "This Name Allready Enter In Database");
                    saveFlag = false;
                }
                else if (dt.Rows.Count == 0)
                {
                    errorProvider1.SetError(item_catagory_nameTextBox, "");
                    saveFlag = true;
                }
            }
        }

Leave a Reply

Powered by Blogger.