Beispiel #1
0
        //搜索
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            ProductInfoBLL bll = new ProductInfoBLL();
            string         txt = txtSearch.Text;
            int            n   = 0;

            if (!string.IsNullOrEmpty(txt))
            {
                if (char.IsLetter(txt[0]))//是不是字母
                {
                    n = 2;
                }
                else//不是字母
                {
                    n = 1;
                }
            }
            dgvProduct.AutoGenerateColumns      = false;
            dgvProduct.DataSource               = bll.GetProductBySpellOrNum(txt, n);
            dgvProduct.SelectedRows[0].Selected = false;
        }