It was working but your main UI thread is busy in your loops thats
why changes are NOT visible. In these type of scenarios we use
multi-threading, and can simply use backgroundworker.

On Thu, Jun 18, 2009 at 5:51 PM, musa.biralo <[email protected]> wrote:

>
> Hi there,
>
> I am not sure why the very simple code is not working. I have asked
> very similar question before and it is somewhat based on that "How to
> update StatusStrip from class to  form". Any help will be a great
> help!!!
>
> -----------------------
> Public Class Form1
>
>    Public trash As New Class1
>
>    Private WithEvents eventsUpdateSSclass1 As
> UpdateStatusStrip.Class1
>
>    Private Sub UpdateStatusStrip(ByVal msg As String, ByVal color As
> Color) Handles eventsUpdateSSclass1.UpdateStatusStrip
>
> Me.ToolStripStatusLabel1.Text = msg
>        Me.ToolStripStatusLabel1.BackColor = color
>        Me.StatusStrip1.Refresh()
>
>    End Sub
>
>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles Button1.Click
>        trash.runRunRun()
>    End Sub
>
> End Class
>
> ------------------------------------
> Public Class Class1
>
>    Public Sub New()
>    End Sub
>
>    Public Event UpdateStatusStrip(ByVal msg As String, ByVal color As
> Color)
>
>    Public Sub runRunRun()
>        Dim k As Integer = 0
>        For i As Integer = 1 To 100
>            For j As Integer = 1 To 1000
>                k = j + i
>                RaiseEvent UpdateStatusStrip(CStr(k), Color.Orange)
>                'call UpdateStatusStrip(CStr(k), Color.Orange) is not
> working.
>
>            Next
>        Next
>        RaiseEvent UpdateStatusStrip(String.Empty, Nothing) 'to check
>    End Sub
>
> End Class
> --------------------------------------------

Reply via email to