G
Guest
Hello,
I am trying to put a very simple animation on a page. I want two images to
show alternately in a defined area. I tried to have an image control and a
timer control on a page. I am setting the Imageurl property of the image
control to two difeent images at fixed time interval. but the image remains
fixed on my page. It never resets to other image. Perhaps I need to Refresh
the page at every timeinterval.
My code is as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
SetTimer()
End Sub
Private Sub SetTimer()
Try
AddHandler Timer1.Elapsed, AddressOf OnTimer
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
Image1.ImageUrl = "C:\Sunset.jpg"
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs)
Try
If Image1.ImageUrl = "C:\Sunset.jpg" Then
Image1.ImageUrl = "C:\Winter.jpg"
Else
Image1.ImageUrl = "C:\Sunset.jpg"
End If
Catch ex As Exception
Response.write(ex.Message)
End Try
End Sub
Any suggestion shall be appreciated.
Cheers,
siaj
I am trying to put a very simple animation on a page. I want two images to
show alternately in a defined area. I tried to have an image control and a
timer control on a page. I am setting the Imageurl property of the image
control to two difeent images at fixed time interval. but the image remains
fixed on my page. It never resets to other image. Perhaps I need to Refresh
the page at every timeinterval.
My code is as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
SetTimer()
End Sub
Private Sub SetTimer()
Try
AddHandler Timer1.Elapsed, AddressOf OnTimer
Timer1.Enabled = True
Timer1.Interval = 1000
Timer1.Start()
Image1.ImageUrl = "C:\Sunset.jpg"
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Sub
Public Sub OnTimer(ByVal source As Object, ByVal e As ElapsedEventArgs)
Try
If Image1.ImageUrl = "C:\Sunset.jpg" Then
Image1.ImageUrl = "C:\Winter.jpg"
Else
Image1.ImageUrl = "C:\Sunset.jpg"
End If
Catch ex As Exception
Response.write(ex.Message)
End Try
End Sub
Any suggestion shall be appreciated.
Cheers,
siaj