c# - 没有建议 TextBox.AutoComplete
问题描述
我正在尝试使用 AutoComplete 属性来获取带有建议的文本框,但当前代码不起作用
private void MainForm_Load_1(object sender, EventArgs e)
{
this.dataGridView1.DataSource = global.sellableItems;
AutoCompleteStringCollection myCustomStringCollect = new AutoCompleteStringCollection();
myCustomStringCollect.AddRange(new string[]{"Facet Hatchet",
"Facet Fishing Rod",
"Facet Hat of Crafting",
"Facet Coat of Crafting",
"Facet Gloves of Crafting",
"Facet Trousers of Crafting",
"Facet Boots of Crafting",
"Facet Cap of Gathering",
"Facet Coat of Gathering",
"Facet Fingerless Gloves of Gathering",
"Facet Bottoms of Gathering",
"Facet Boots of Gathering"});
this.textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
this.textBox1.AutoCompleteCustomSource = myCustomStringCollect;
}
编译后,我尝试了它,但它不起作用。
解决方案
推荐阅读
- xamarin - How to detect if user requested a tab change on TabbedPage in Xamarin.Forms
- meteor - 如何将数据传递到Framework7中的模板中?
- ios - 将 UIDocumentInteractionController 中的预览呈现为 UIViewController 的 ChildViewController
- node.js - 如何在 Electron 应用程序上获得圆角?
- javascript - 更新 $scope 但 $watch 未检测到的 Mousetrap 键绑定。
- javascript - 双括号 但不是 IIFE 或闭包,它是什么?它是有效的 JS 语法吗?
- google-sheets - 引用单元格文本的 Google 表格查询
- amazon-dynamodb - DynamoDB 表未在 serverless.yml 文件中创建
- r - 在 apply 的函数中使用 dplyr::group_by
- javascript - 如何检查具有模糊性的字符串中的子字符串?