C# compile error: “Invoke or BeginInvoke cannot be called on a control until the window handle has been created.”

前端 未结 9 905
时光取名叫无心
时光取名叫无心 2020-12-16 23:16

I just posted a question about how to get a delegate to update a textbox on another form. Just when I thought I had the answer using Invoke...this happens. Here is my code:<

9条回答
  •  甜味超标
    2020-12-16 23:58

    I found the InvokeRequired not reliable, so I simply use

    if (!this.IsHandleCreated)
    {
        this.CreateHandle();
    }
    

提交回复
热议问题