private void txtSearch_TextChanged(object sender, EventArgs e) { int flag = 0; if (string.IsNullOrEmpty(txtSearch.Text)) { LoadProductInfoByDelFlag(0); return; } else { flag = char.IsNumber(txtSearch.Text[0]) ? 2 : 1; var bll = new ProductInfoBLL(); dgvProduct.DataSource = bll.GetProductInfoBySpellNum(txtSearch.Text, flag); if (dgvProduct.SelectedRows.Count > 0) { dgvProduct.SelectedRows[0].Selected = false; } } }