rmonteiro 0 Denunciar post Postado Setembro 11, 2008 Galera estou o usando o código abaixo mas estou tendo problemas com um dos componentes: Imports System.Threading Public Class principal Private spy As Thread Public Sub spylog() Do [b]Me.loglist.Items.Add("String qualquer")[/b] Loop End Sub Private Sub principal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load spy = New Thread(AddressOf spylog) spy.IsBackground = True spy.Start() End Sub End Class Quando ele executa a instrução em negrito aparece o seguinte erro: Cross-thread operation not valid: Control 'loglist' accessed from a thread other than the thread it was created on. Alguem sabe como posso resolver isso? Compartilhar este post Link para o post Compartilhar em outros sites
Panarello 0 Denunciar post Postado Setembro 28, 2008 eu tava com o mesmo problema e a solucao desse site resolveu meu problema http://www.webly.com.br/tutorial/net/13051...ad-sem-erro.htm Compartilhar este post Link para o post Compartilhar em outros sites
jpaulino 2 Denunciar post Postado Outubro 7, 2008 Você tem de usar delegates. Veja o seguinte exemplo: VB.NET: Trabalhando com threads (multi-tarefas) Compartilhar este post Link para o post Compartilhar em outros sites