Hello,
I have a list of string having 10000 Items in it.
I am trying to add this in combobox with auto complete as Custom Source.
I wanted to add this items in backgroundworker but Its getting error like below
System.InvalidcastException: Interface not registered.
Below is the piece of code to reproduce
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Threading.Tasks;
> using System.Windows.Forms;
>
> namespace WindowsFormsApp1
> {
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
> CheckForIllegalCrossThreadCalls = false;
> }
>
> private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
> {
> try
> {
> BindListInComboBox(comboBox1);
> }
> catch (Exception ex)
> {
> MessageBox.Show(ex.ToString());
> }
> }
>
> private void BindListInComboBox(ComboBox comboBox)
> {
> List<string> myList = new List<string>() { "A", "B", "AB", "AC", "DB" };
> var autoComplete = new AutoCompleteStringCollection();
> autoComplete.AddRange(myList.ToArray());
> comboBox.AutoCompleteCustomSource = autoComplete;
> comboBox.SelectedIndex = -1;
> }
>
> private void Form1_Load(object sender, EventArgs e)
> {
> backgroundWorker1.RunWorkerAsync();
> }
> }
> }

