AutoCompleteCustomSource错误:接口未注册

时间:2019-06-13 07:09:55

标签: c# mysql

我正在为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();
}

0 个答案:

没有答案