Locked word.quit event actions

  • Thursday, July 19, 2012 7:37 AM
     
     

    http://social.msdn.microsoft.com/Forums/en-US/vbinterop/thread/ce40e709-864d-43a3-a2aa-efa8524a5696/

    Having added a word.quit event as outlined above, I cannot seem to get any code to work in it i.e.

    PrivateSuboWord_Quit() HandlesoWord.Quit

           oWord = nothing

    Label1.text = "Done"

    End Sub

    I get

    Cross-thread operation not valid: Control 'Label1' accessed from a thread other than the thread it was created on.

    Have tried to look at using backgroundworker but still get the same

    How should code be written to execute after word quits ? Thank you

All Replies

  • Thursday, July 19, 2012 5:03 PM
     
     Answered Has Code

    In the event handler:

    BeginInvoke(New action(AddressOf SetLabelDone))

    And add this sub to the Form:

       Private Sub SetLabelDone()
    
          Label1.Text = "Done"
    
       End Sub


    Armin

    • Marked As Answer by GFSIan Thursday, July 19, 2012 5:43 PM
    •  
  • Thursday, July 19, 2012 5:44 PM
     
     
    Excellent - That's it - Thank you