0

Hi i have problem with my timer. when application run it does not go to the timer at all.I have no idea where do i need to troubleshot anymore. Please help if anyone know !

If CheckStatusStr = "0" Then
                    Update_CurrBal()
                    SuccessfullySave()
                ElseIf CheckStatusStr = "1" Then
                    timercount = 0
                    Timer2.Enabled = True
                    Timer2.Start()
                    End If
                Application.DoEvents()
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            If timercount > 5 Then
            Timer2.Enabled = False
            PaymentDone()
        Else
            timercount += 1
            End If
    End Sub
3
Contributors
13
Replies
14
Views
5 Years
Discussion Span
Last Post by swathys
0

yes. i have use enable.true and i have set interval = 1000 at property list

If CheckStatusStr = "0" Then
       Update_CurrBal()
       SuccessfullySave()
       ElseIf CheckStatusStr = "1" Then
       timercount = 0
        Timer2.Enabled = True
       Timer2.Start()
       End If
       Application.DoEvents()

Edited by swathys: n/a

0

Any time control is going to Timer2_Tick event? Is timerCount is getting greater than 5 any time?

0

yes...it goes more than 6...so if more than 5 i have set it to go to the function again and check whether the status is "0" or "1"
if the status is "1" i make it to loop again

Edited by swathys: n/a

0

So where exactly is your problem? timer is firing fine, Count is getting greater than zero. Where is the problem?

0

the timer doesn't work at all if i run the application (by mean it doesn't go to the timer function at all) but when i use debug breakpoint and debug line by line it goes to the timer function and work as it suppose to be . So now i don't know whats wrong with my code actually.

0

try setting the timer enable at proprties where u set the time.
And make sure that the function or method in which ur using the timer is firing and running fine.

0

swathys, perhaps you can post more code. that would be really useful. .aspx and the .cs parts.
I can copy and paste into my visual studio and see what's going on.

0

this is the sample code...exactly i use in my application

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        PaymentDone()
        Debug.Print("application end")
        End
    End Sub
Public Sub PaymentDone()

        CheckServerStatus()

        If CheckStatus = "0" Then
            MsgBox("0")
        ElseIf CheckStatus = "Good" Then

            timercount = 0
            Timer2.Interval = 1000
            Timer2.Enabled = True
            Timer2.Start()
        End If
        Application.DoEvents()
        Debug.Print("after timer")
        End Sub
Public Function CheckServerStatus() As String

        CheckStatus = "Good"

        Return CheckStatus

    End Function
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If timercount > 1 Then
            Timer2.Enabled = False
            Debug.Print("goto paymentDone")
            PaymentDone()
        Else
            timercount += 1
            Debug.Print(timercount)
        End If
    End Sub
0

after execute this code

ElseIf CheckStatus = "Good" Then

            timercount = 0
            Timer2.Interval = 1000
            Timer2.Enabled = True
            Timer2.Start()
        End If
        Application.DoEvents()
        Debug.Print("after timer")
        End Sub

it goes to

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        PaymentDone()
        Debug.Print("application end")
        End
    End Sub

and end the application.This is what happen after i run my application. It doesn't goto timer at all.

Edited by swathys: n/a

0

if i remark "end" and run the application it works perfect but i need to use "end" to exit the application if it meet the condition
"If CheckStatus = "0" Then" and "If CheckStatus = "1" then" it suppose to loop (execute timer)until it meets "If CheckStatus = "0" condition

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        PaymentDone()
        Debug.Print("application end")
       ' End
    End Sub
0

anyone knows whats the problem wt my code....what i have missed out....still not able to find the solution

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.