//模糊搜索 private void txtSearch_TextChanged(object sender, EventArgs e) { int temp = string.IsNullOrEmpty(txtSearch.Text) ? 0 : char.IsLetter(txtSearch.Text[0]) ? 1 : 2; dgvProduct.AutoGenerateColumns = false; dgvProduct.DataSource = probll.GetProductByProSpellOrProNum(temp, txtSearch.Text); dgvProduct.ClearSelection(); }