DevAdmin Blog

Blog di Ermanno Goletto (Microsoft MVP Directory Services - MCITP - MCTS - MCSA - MCP)
posts - 887, comments - 449, trackbacks - 13

My Links

News

Avatar

Curriculum Vitae

Visualizza il profilo di Ermanno Goletto su LinkedIn


Il contenuto di questo blog e di ciascun post viene fornito “così come é”, senza garanzie, e non conferisce alcun diritto. Questo blog riporta il mio personale pensiero che non riflette necessariamente il pensiero del mio datore di lavoro.

Logo Creative Commons Deed


Logo SysAdmin.it SysAdmin.it Staff


Logo TechNet Forum TechNet Italia @ForumTechNetIt Follow TechNet Forum on Twitter


Logo MVP


Ermanno Goletto Follow ermannog on Twitter

Article Categories

Archives

Post Categories

Blogs

Friends

Knowledge Base

MVP Sites

Resources

Attendere il completamento di BackgroundWorker

Per attendere che un BackgroundWorker termini l’esecuzione asincrona, ad esempio per chiudere una form in modo corretto, il modo più semplice è quello di usare la proprietà Busy e invocare il metodo Application.DoEvents() per non bloccare l’interfaccia utente come indicato in BackgroundWorker.IsBusy Property.

Esempio:

Private Sub FormMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    While Me.backgroundWorker1.IsBusy
        Application.DoEvents()
    End While
End Sub

Print | posted on Friday, February 11, 2011 11:58 AM | Filed Under [ Links Code, Snippets & Scripts .NET ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 8 and 6 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET