Home All Groups Group Topic Archive Search About

My Threading Timer Doesn't Fire

Author
28 Mar 2005 7:44 PM
Daniel Maycock via .NET 247
I can't get my threading timer to show a splash screen panel for six seconds, then move onto the next panel. The timer just doesn't tick (this is aparent when I set the time to wait to 100 and it never fires off the sub)

I've tried using java, I've tried using the system timer - this is my last hope - please help!

Here's my Code
-----------------

    Private strConn As String = ConfigurationSettings.AppSettings("conString")

    Private Sub btnAgree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAgree.Click
        Dim oCallback As New TimerCallback(AddressOf OnTick)
        Dim lPeriod As Long = 6000
        Try
            oTimer = New System.Threading.Timer(oCallback, Nothing, 0, lPeriod)
        Catch ex As Exception
            Response.Write("It Didn't Work")
        End Try

        pnl4.Enabled = True
        pnl4.Visible = True
        pnl9.Enabled = False
        pnl9.Visible = False


    Private Sub OnTick(ByVal state As Object)
        pnl4.Visible = False
        pnl9.Enabled = True
        pnl9.Visible = True

    End Sub

--------------------------------
From: Daniel Maycock

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>MMswZETqaEGmnOTUwMNnOA==</Id>

Author
29 Mar 2005 5:19 AM
MeltingPoint
Daniel Maycock via .NET 247 <anonym***@dotnet247.com> wrote in
news:ujSYL68MFHA.568@TK2MSFTNGP09.phx.gbl:

>  Try
>  oTimer = New System.Threading.Timer(oCallback, Nothing, 0,lPeriod)
>             
>  Catch ex As Exception
>             Response.Write("It Didn't Work")
>  End Try
>

In VB.NET

First define oTimer outside the Try block since its scoped, second lPeriod
is in the wrong position, it should be (oCallback,Nothing,lPeriod,0) if
your intention is to delay the client for 6 sec before moving on.

Hope this helps,
MP
Author
22 Feb 2007 1:55 PM
Rodintino
'adipex' (http://adipex-hgf65.blogspot.com/) http://adipex-hgf65.blogspot.com/
See you. -- Rodintino ------------------------------------------------------------------------ Rodintino's Profile: http://www.hightechtalks.com/m827 View this thread: http://www.hightechtalks.com/t323539