How to read combobox from a thread other than the thread it was created on?

前端 未结 4 2029
眼角桃花
眼角桃花 2020-12-25 11:43

I am trying to read a combobox.Text from a thread other than the thread it was created on but I am getting the error:

An unhandled exception of type

4条回答
  •  清酒与你
    2020-12-25 12:29

    You can do it like this:

    this.Invoke((MethodInvoker)delegate()
        {
            text = combobox.Text;
        });
    

提交回复
热议问题