Results 1 to 2 of 2

Thread: timer

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    timer

    Hi everyone,
    While a process is running I would like the statusbar1.text to blink on shwing a message such as "Processing..."

    I have two timers. Timer 1 is set to 1000 interval and timer 2 to 500 interval
    both are enabled.

    while debugging I can see that they are both been read but the data does not get displayed may be it is because there is no time for the statusbar1 to be refreshed. And I believe I may be able to use something like doevents. but doevents does not work in vb.net ?
    Any ideas?
    Thanks

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    StatusBar1.Text = "Processing Data. Please wait..."
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    StatusBar1.Text = ""
    End Sub

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678
    It still does not work...
    I have the following in the code

    The property, enabled for the timer is set to false, the interval is 500


    'Run the process as a separate thread...
    Private t As New Thread(AddressOf Me.PopulateExcel)

    Private Sub btnExcelStrategies_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExcelStrategies.Click
    t.Start() 'populates excel in a separate thread, to prevent locking...
    End Sub

    private sub PopulateExcel()

    '''populates excel cells... this takes about 10 minutes to complete...

    End Sub

    Private Sub EnableTimer()
    Timer1.Enabled = True
    End Sub

    Private Sub DisableTimer()
    Timer1.Enabled = False
    StatusBar1.Text = ""
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Application.DoEvents()

    If StatusBar1.Text = "" Then
    StatusBar1.Text = "Processing Data..."
    Else
    StatusBar1.Text = ""
    End If
    End Sub
    Last edited by fmardani; Sep 24th, 2003 at 11:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width