Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/04/2012, 20:54
Avatar de elarrieux
elarrieux
 
Fecha de Ingreso: abril-2012
Ubicación: Uruguay
Mensajes: 67
Antigüedad: 12 años
Puntos: 26
Respuesta: "No responde" con For To

Lo que tenes que hacer es tirar la tarea en un nuevo Thread.

Va ejemplo, funciona ya lo probe:

Código:
Imports System.Threading

Public Class Form1

    Private demoThread As Thread
    Private a As Double

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

        Me.demoThread = New Thread(New ThreadStart(AddressOf Me.ThreadProcUnsafe))

        Me.demoThread.Start()

    End Sub

    Private Sub ThreadProcUnsafe()
        For i = 0 To 100000000
            a += 1
            ActualizarBoton(Me.Button1, a.ToString)
        Next
    End Sub

    Sub ActualizarBoton(btn As Button, text As String)
        If btn.InvokeRequired Then
            btn.Invoke(New Action(Of Button, [String])(AddressOf ActualizarBoton), New Object() {btn, text})
        Else
            btn.Text = text
        End If
    End Sub
End Class
Espero te sirva.

Sds.