Hi everyone!
I am getting another strange error that I'm hoping I could get some assistance on. The error is a ThreadStateException error.
System.Threading.ThreadStateException was unhandled by user code
Message=Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
What I'm trying to do is let a background worker complete and load the new form after hiding the original one. It gets halfway down the designer generated code before this error appears. Below is some context of where the error appears.
this.transmissionCodeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.transmissionCodeComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.transmissionCodeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.transmissionCodeComboBox.Enabled = false;
this.transmissionCodeComboBox.FormattingEnabled = true;
this.transmissionCodeComboBox.Location = new System.Drawing.Point(271, 309);
this.transmissionCodeComboBox.Name = "transmissionCodeComboBox";
this.transmissionCodeComboBox.Size = new System.Drawing.Size(121, 21);
this.transmissionCodeComboBox.TabIndex = 65;
this.transmissionCodeComboBox.SelectedIndexChanged += new System.EventHandler(this.transmissionCodeComboBox_SelectedIndexChanged);
It is failing on this line.
this.transmissionCodeComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
Does anyone know how this issue can be resolved?
Thanks everyone!