locked
i want to update label from thread but give me this error please help me: RRS feed

  • Question



  • hi

    i want to update label from thread but give me this error please help me:

    while(Thread.IsAlive)
    Label1.BeginInvoke((MethodInvoker)delegate() { Label1.Text =  "xxxxxxxxx"; });

    //-----------------------------------------------------------------------------------------------------------

    error
    Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
    Thanks Motevallizadeh
    Monday, November 9, 2009 7:54 AM

Answers

  • Hi,

    Try moving that code to the load event of the form, or some where that occurs after that event does. As the error message says, until the controls handle has been created you can't use invoke or begin invoke.
    • Marked as answer by liurong luo Friday, November 13, 2009 5:15 AM
    Monday, November 9, 2009 8:13 AM

All replies