我正在为AutoCompleteCustomSource
数据库中的Mysql
进行编码。
运行代码时,出现错误
:接口未注册。
AutoCompleteStringCollection autocategory = new
AutoCompleteStringCollection();
try
{
conn = new MySqlConnection(ConnectionString.getConnection());
conn.Open();
cmd = new MySqlCommand(query, conn);
dr = cmd.ExecuteReader();
while (dr.Read())
{
autocategory.Add(dr.GetString(0));
}
textbox.AutoCompleteMode = AutoCompleteMode.Suggest;
textbox.AutoCompleteSource = AutoCompleteSource.CustomSource;
textbox.AutoCompleteCustomSource = autocategory;
conn.Close();
}