i can't get countdown.....

  • Thread starter Thread starter Supra
  • Start date Start date
S

Supra

i can't get countdown timer working in webform.....

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStart.Click
Dim rnd1 As New Random
lblMin.Text = Int(rnd1.Next(15, 30))
lblSec.Text = Int(rnd1.Next(1, 60))
tmrSuduko.Enabled = True
tmrSuduko.AutoReset = True
end sub

Private Sub tmrSuduko_Elapsed(ByVal sender As System.Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles tmrSuduko.Elapsed
tmrSuduko.Enabled = True
If Format(sT, "mm") & " : " & Format(sT, "ss") <> "00 : 00" Then
sT = DateAdd(DateInterval.Second, -1, sT)
lblTimeLeft.Text = "Time left : " & Format(sT, "mm") & " :
" & Format(sT, "ss")
tmrSuduko.AutoReset = True
tmrSuduko.Enabled = True
Else
End If
End Sub

i don't know anything about Elapsed keyword. work!!!!!!
regards
 
Supra,

Why you start a new message thread,

Please stay in the same message thread, otherwise we start new.

I gave you an answer and you ignore that completly

Cor
 
'm starting webform project. i am almost finished suduko project from
vb.net. now in webform...i don't know how what to start with imports....
i dragged timer webform compoent tab to webpage and :-( .

Option Explicit On
Option Strict Off
Imports System.Timers.Timer
Public Class webSuduko
Inherits System.Web.UI.Page
\\
\\
\\
end class
in webform component tab i can see timer control of toolbox but not on
weform tab tof toolbox..
if ne 1 wants to test my suduko.exe. please feel free and do not
hesitate to ask newsgroup 8-)
regards,
 
Hi Supra,,,


what you want can`t be done from the server side ,,,

however as Cor tried to explain to you this can be done with some client
side script


i have prepared a small demo for you

open a new webform , throw a label on this webform

now in the page load event paste this code

Dim counter As Integer

If IsNothing(Session.Item("counter")) Then

Session.Item("counter") = 0

Else

counter = (Session.Item("counter"))

counter += 1

Session.Item("counter") = counter

End If

If counter <= 9 Then

Dim script As String = "<script language=""JavaScript"">" & _

"setTimeout('window.location.href=window.location.href',1000)</script>"

Page.RegisterStartupScript("refresh", script)

Label1.Text = String.Concat("counting : ", counter.ToString)

ElseIf counter = 10 Then

Label1.Text = String.Concat("well i just counted to ", counter.ToString, " i
feel that this is enough for today")

End If


this will show a counter that stops at 10

i hope this will give you an idea ,

regards

Michel Posseth
 
now i understsood =-O . i am attempting how to get time remaining.
start time : 10 :38
time left : 10: 37

i will try to do this from cor example.
regards
 
Back
Top