如何在自动完成模式下搜索第二个单词

时间:2019-04-18 04:56:39

标签: search autocomplete

在自动完成过滤器中,我们需要第二个单词搜索。通过使用我们的代码,我们在c#中只有第一个单词搜索。

private void datagrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (dgvdetails.CurrentCell.ColumnIndex == 2) {string titleText = dgvdetails.Columns[2].HeaderText; if (titleText.Equals("Product Name"))
{TextBox autoText = e.Control as TextBox; if (autoText != null){autoText.AutoCompleteCustomSource = LoadAutoComplete();                      autoText.AutoCompleteMode = AutoCompleteMode.Suggest; autoText.AutoCompleteSource = AutoCompleteSource.CustomSource;}}}}
private AutoCompleteStringCollection LoadAutoComplete(){ DataTable dt = new DataTable();  dt = estimatesub.Searchproduct(num);           AutoCompleteStringCollection stringCol = new AutoCompleteStringCollection();
foreach (DataRow row in dt.Rows){                stringCol.Add(Convert.ToString(row[1])); } return stringCol; }

0 个答案:

没有答案